美文网首页
如何生成swagger在线接口文档

如何生成swagger在线接口文档

作者: 国王兔子 | 来源:发表于2019-04-12 15:03 被阅读0次

swagger

  • 是一款让你更好的书写API文档的规范且完整框架。
  • 提供描述、生产、消费和可视化RESTful Web Service。
  • 是由庞大工具集合支撑的形式化规范。这个集合涵盖了从终端用户接口、底层代码库到商业API管理的方方面面。

使用方法

  • 在pom.xml文件中添加第三方swagger依赖()
    <dependency>
        <groupId>com.spring4all</groupId>
        <artifactId>swagger-spring-boot-starter</artifactId>
        <version>1.7.0.RELEASE</version>
    </dependency>
  • 在主类中添加@EnableSwagger2Doc
@SpringBootApplication
@EnableSwagger2Doc
public class SpringbootSwaggerApplication {

    public static void main(String[] args) {
        SpringApplication.run(Springboot2Swagger2Application.class, args);
    }
}

Swagger访问地址http://localhost:8080/swagger-ui.html

配置

swagger.enabled=true
swagger.title=spring-data-jpa module
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/MQY1005/SpringBoot
swagger.contact.name=mqy
swagger.contact.url=https://www.jianshu.com/u/d9b76cc271c5
swagger.contact.email=*****@gmail.com
swagger.base-package=com.springboot.mybatis.controller
swagger.base-path=/**
swagger.exclude-path=/error, /ops/**

相关文章

网友评论

      本文标题:如何生成swagger在线接口文档

      本文链接:https://www.haomeiwen.com/subject/gfycwqtx.html