SpringBoot 整合 Swagger 2

SpringBoot整合Swagger 2

  1. 添加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>
  2. 启动类添加@EnableSwagger2注解

    @EnableSwagger2
    @SpringBootApplication
    public class Application {
        public static void main(String[] args) {
            SpringApplication.run(Application.class, args);
        }
    }
    
  3. 启动项目,访问路径:http://localhost:8080/swagger-ui.html
  4. 运行结果:

    SpringBoot 整合 Swagger 2

上一篇:挖槽,Sharding-JDBC强制走主库,一不留神就报错了


下一篇:UML 元模型