详解SpringBoot结合swagger2快速生成简单的接口文档
2019-05-12 18:01
1056 查看
1. pom.xml中加入依赖
<dependency> <groupId>com.spring4all</groupId> <artifactId>swagger-spring-boot-starter</artifactId> <version>1.8.0.RELEASE</version> </dependency>
2. 在启动类(即带@SpringBootApplication这个注解的类)上添加@EnableSwagger2Doc注解
3. 在application.properties中配置如下
swagger.enabled=true swagger.title=spring-boot-mybatis module api swagger.description=Starter for swagger 2.x swagger.license=Apache License, Version 2.0 swagger.licenseUrl=https://www.apache.org/licenses/LICENSE-2.0.html swagger.termsOfServiceUrl=https://github.com/pbw123/spring-boot-demo swagger.contact.name=mqXu swagger.contact.url=https://www.jianshu.com/u/2f60beddf923 swagger.contact.email=2635225112@qq.com swagger.base-package=com.springboot.mybatis.controller swagger.base-path=/** swagger.exclude-path=/error, /ops/**
经我多次尝试application.properties中不加任何swagger配置也可生成文档进行正常测试
另一种用swagger自动生成文档的方式请前往
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
相关文章推荐
- Spring Boot 集成 Swagger,生成接口文档就这么简单!
- springboot结合swagger自动生成接口文档
- springboot项目利用Swagger2生成在线接口文档
- spring boot 整合swagger2 实现动态生成接口文档
- springboot中使用swagger2构建restful接口文档
- Spring 整合 Swagger2 生成接口文档
- Spring Boot(九)Swagger2自动生成接口文档和Mock模拟数据
- spring boot 中使用swagger 来自动生成接口文档
- springboot-swagger2 Restful接口文档的形成
- Spring Boot中结合Swagger2构建接口
- Swagger2 生成 Spring Boot API 文档
- SpringBoot整合Swagger2,再也不用维护接口文档了!
- Spring Boot学习笔记 - 整合Swagger2自动生成RESTful API文档
- Swagger2 生成 Spring Boot API 文档
- Spring boot结合swagger自动生成api文档
- SpringBoot整合Swagger2,再也不用维护接口文档了!
- 使用 SpringBoot + Swagger 生成接口 API 文档
- springboot apidoc自动生成接口文档
- Swagger自动接口文档生成框架————springboot整合swagger总结
- Spring Boot 使用Swagger2自动生成RESTful API文档