1、引入pom坐标
<!--swagger--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>3.0.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> <version>3.0.0</version> </dependency>
2、配置类
@Configuration public class SwaggerConfig { @Bean public Docket docket() { return new Docket(DocumentationType.OAS_30) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder().build(); } }
3、application.yml配置
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
4、重启项目访问swagger页面
http://127.0.0.1:8090/swagger-ui/index.html
- SpringBoot2 SpringBoot Swagger3 Swaggerspringboot2 springboot swagger3 swagger springboot swagger3 swagger springboot swagger3权限swagger springboot swagger3 knife4j swagger swagger3 注解swagger3常用swagger swagger swagger2 swagger3 amp modelconverter swagger3 openapi3对象 springboot2 springboot2 springboot