swagger

==保证依赖版本,版本不一致会出现莫名其妙的问题==

  • spring boot 版本低于2.6

  • swagger 使用 2.9.2

<!-- swagger -->
<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>

@EnableSwagger2添加在启动

@EnableSwagger2
@SpringBootApplication
public class BlogSquareApplication {

    public static void main(String[] args) throws NoSuchAlgorithmException {
        ConfigurableApplicationContext run = SpringApplication.run(BlogSquareApplication.class,
                args);
    }

}

添加swagger-config

打开即可Swagger UIarrow-up-right

Last updated