详解SpringBoot结合swagger2快速生成简单的接口文档

网友投稿 222 2023-01-07


详解SpringBoot结合swagger2快速生成简单的接口文档

1. pom.xml中加入依赖

com.spring4all

swagger-spring-boot-starter

1.8.0.RELEASE

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://apache.org/licenses/LICENSE-2.0.html

swagger.termsOfServiceUrl=https://github.com/pbw123/spring-boot-demo

swagger.contact.name=mqXu

swaggerhttp://.contact.url=https://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自动生成文档的方式请前往


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:接口自动化框架图片设计(常用自动化框架)
下一篇:最常用的接口测试工具(简单的接口测试)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~