Spring boot 配置 swagger
2017-07-17 20:26
387 查看
1、maven配置包
2、配置类
3、访问地址: http://localhost:8080/swagger-ui.html
官方使用说明:http://springfox.github.io/springfox/docs/current/
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.7.0</version> </dependency> <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.7.0</version> </dependency>
2、配置类
@Configuration @EnableSwagger2 public class Swagger2Config { @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.example.demo")) //这里改成你报controller报名即可 .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("RESTful APIs") .description("RESTFul API 文档") .version("1.0") .build(); } }
3、访问地址: http://localhost:8080/swagger-ui.html
官方使用说明:http://springfox.github.io/springfox/docs/current/
相关文章推荐
- spring-boot-starter-swagger 1.3.0.RELEASE:新增对JSR-303的支持和host的配置
- springboot-mybatis配置swagger
- Swagger配置(SpringMVC、SpringBoot)
- springboot+swaggerui配置
- spring-boot从创建到部署(内含swagger配置)
- Swagger基于Spring Boot上配置
- spring-boot-starter-swagger 1.2.0.RELEASE:新增分组配置功能
- spring-boot-starter-swagger 1.2.0.RELEASE:新增分组配置功能
- 解决spring boot中swagger-ui.html访问404以及配置全局header
- SpringBoot中自定义properties文件配置参数并带有输入提示
- Spring boot+Shiro+ spring MVC+swagger UI +Mybatis+mysql+Vue +Element UI 之四 vue 基本知识点概述
- Spring boot配置拦截器
- Spring Boot: (三)web开发配置
- spring boot 配置日志
- SpringBoot下如何配置实现跨域请求?
- 5分钟构建springboot、maven、swagger项目
- spring boot 读取配置文件(application.yml)中的属性值
- spring boot利用swagger和spring doc生成在线和离线文档
- shell 管理SpringBoot 生产环境服务 (配置JVM)
- Spring Boot教程(一)注解配置与EhCache使用