zoukankan      html  css  js  c++  java
  • Spring Boot 使用 Swagger UI

    引入pom依赖:

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.9.2</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.9.2</version>
    </dependency>

    到GitHub https://github.com/swagger-api/swagger-ui 下载项目,dist目录拷贝出来直接放到资源路径.

    index.html 即为api页面

    然后在Spring Boot 启动类加上注解 @EnableSwagger2

    @SpringBootApplication
    @EnableSwagger2
    public class NeteaseApplication {
        public static void main(String[] args) {
            SpringApplication.run(NeteaseApplication.class, args);
        }
    }

    Api 地址:http://localhost:8080/api/index (地址由存放的资源路径文件夹决定)

    Api-json:http://localhost:8080/v2/api-docs

    Swagger2 常用注解: https://blog.csdn.net/u014231523/article/details/76522486

  • 相关阅读:
    things to analysis
    retrieve jenkins console output
    temp
    temp
    mysql on Mac OS
    Scala的几个小tips
    docker查看容器使用率
    JVM性能监控(jconsole和jvisualvm)
    线程死锁问题
    线程阻塞状态
  • 原文地址:https://www.cnblogs.com/cearnach/p/8973499.html
Copyright © 2011-2022 走看看