1  在pom.xml中加入Swagger2的依赖

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>

2  

@Configuration
@EnableSwagger2
public class SwaggerConfig { @Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("tech.duor.sunflower"))//扫描包
.paths(PathSelectors.any())
.build();
} private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("标题")
.description("描述")
.termsOfServiceUrl("http://duor.tech/")
.contact("创建人")
.version("0.1")
.build();
} }

3 . controller

@Api(description = "xxController", value = "描述")
@CrossOrigin
@RestController
@RequestMapping("/api/system")
//@Scope("prototype")
public class PalletController { @ApiOperation(value = "查询全部的货盘分页展示", notes = "")
@ApiImplicitParam(name = "Authorization", paramType = "header")
@RequestMapping(value = "/pallet", method = RequestMethod.GET)
public RestResult QueryPallets(){} }

https://www.jianshu.com/p/8033ef83a8ed

https://www.imooc.com/article/20521


在浏览器中输入你配置的网址就可以访问
http://localhost:8011/index.html

https://www.jianshu.com/p/528b2db2ab7f

下载  dist   放到

修改  index.html

spring boot 集成swagger2的更多相关文章

  1. Spring Boot 集成 Swagger2 与配置 OAuth2.0 授权

    Spring Boot 集成 Swagger2 很简单,由于接口采用了OAuth2.0 & JWT 协议做了安全验证,使用过程中也遇到了很多小的问题,多次尝试下述配置可以正常使用. Maven ...

  2. Spring boot集成swagger2

    一.Swagger2是什么? Swagger 是一款RESTFUL接口的文档在线自动生成+功能测试功能软件. Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格 ...

  3. Spring boot集成Swagger2,并配置多个扫描路径,添加swagger-ui-layer

    Spring boot集成Swagger,并配置多个扫描路径 1:认识Swagger Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目 ...

  4. Spring Boot 集成Swagger2生成RESTful API文档

    Swagger2可以在写代码的同时生成对应的RESTful API文档,方便开发人员参考,另外Swagger2也提供了强大的页面测试功能来调试每个RESTful API. 使用Spring Boot可 ...

  5. Spring Boot 集成 Swagger2 教程

    上篇讲过 Spring Boot RESTful api ,这篇简单介绍下 SwaggerUI 在 Spring Boot 中的应用. Swagger 是一个规范和完整的框架,用于生成.描述.调用和可 ...

  6. Spring Boot之Swagger2集成

    一.Swagger2简单介绍 Swagger2,它可以轻松的整合到Spring Boot中,并与Spring MVC程序配合组织出强大RESTful API文档.它既可以减少我们创建文档的工作量,同时 ...

  7. spring boot整合Swagger2

    Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化RESTful风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同样的速度来更新.文件的方法,参数和模型紧密集成到服务器 ...

  8. Spring Boot 集成 Swagger 生成 RESTful API 文档

    原文链接: Spring Boot 集成 Swagger 生成 RESTful API 文档 简介 Swagger 官网是这么描述它的:The Best APIs are Built with Swa ...

  9. Spring boot集成Swagger,并配置多个扫描路径

    Spring boot集成Swagger,并配置多个扫描路径 1:认识Swagger Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目 ...

随机推荐

  1. 自定义ClassLoader加载加密的class文件

    package com.yd.wmsc.util; public class Test { public void say(){ System.out.println("Say Hello& ...

  2. 读取文件名称cmd命令

    操作步骤: 1.进入命令提示符窗口 开始→运行,键入“CMD”,确定. 开始→程序→附件→C:\命令提示符 2.进入驱动器d: C:\Documents and Settings>d:(回车) ...

  3. LeetCode 230 Kth Smallest Element in a BST 二叉搜索树中的第K个元素

    1.非递归解法 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * ...

  4. 全排列函数(next_permutation)

    顾名思义,这个函数就是用来求数组的全排列的,至于怎么用,看下面的介绍: 这是一个c++函数,包含在头文件algorithm里面,这个函数可以从当前的数组的大小按照字典序逐个递增的顺序排列 看下面的模板 ...

  5. linux 编程笔记 2

    1.使用create建立文件: #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include ...

  6. SQL判断经纬度在矩形内

    1,将城市地图拆分等距拆分为矩形 数据结构如图: 2.查看高德JS API (点是否在多边形内)核心代码: a=[114.069564,22.545774]; b=[ [114.067595,22.5 ...

  7. css相关知识

    display: block; "块级元素". display: inline; "行内元素". display: none; "在不删除元素的情况下 ...

  8. Java实例学习——企业进销存管理系统(1)

    Java实例学习——企业进销存管理系统(1) (本实例为书上实例,我所记录的是我的学习过程) 开始时间:2月12日 完成时间:暂未完成 2月12日—选择企业进销存管理系统 选择企业进销存管理系统这一实 ...

  9. elasticsearch报错:None of the configured nodes are available: []

    问题:在内网测试的时候可以正常访问,但是部署到外网上客户端连接elasticsearch报错:None of the configured nodes are available: [] 原因:默认情 ...

  10. SpringMVC04 很杂很重要(注解,乱码处理,通配符,域属性调用,校正参数名称,访问路径,请求、响应携带参数,请求方法)

    1.导入架包 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3 ...