美文网首页
Spring Boot使用swagger自动化接口文档

Spring Boot使用swagger自动化接口文档

作者: 默写_0c03 | 来源:发表于2018-10-21 15:25 被阅读0次

    Swagger 是一款RESTFUL接口的文档在线自动生成+功能测试功能软件,它的源码地址在github上,源码地址:传送门

    然后自己在github 上找到一个修改swaggerUI的依赖,相比之下还是比原始的比较好看一点。传送门

    具体实现步骤:

    • 在pom.xml文件中添加依赖
            <!--github上找到swaggerUI-->
            <dependency>
                <groupId>com.github.xiaoymin</groupId>
                <artifactId>swagger-bootstrap-ui</artifactId>
                <version>1.8.4</version>
            </dependency>
    
            <dependency>
                <groupId>com.spring4all</groupId>
                <artifactId>swagger-spring-boot-starter</artifactId>
                <version>1.8.0.RELEASE</version>
            </dependency>
    
    • 在主类添加注解@EnableSwagger2Doc
    @EnableSwagger2Doc
    @SpringBootApplication
    public class SpringDataJpaApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(SpringDataJpaApplication.class, args);
        }
    }
    

    相关文章

      网友评论

          本文标题:Spring Boot使用swagger自动化接口文档

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