未解决的坑:
1.Basic用不了,Bearer的引用方式跟以前有点不一样
2.gateway网关统一管理 集中文档只能用SWAGGER_2(2.0),不能用OAS_30(3.0.3)
3.引入基础包的bean不能使用 BeanFactoryAware(导致不能创建多个group)替换
Springfox3配置
引入包
现在只需要一个包 springboot的,不像以前需要两个,当然可以单独引用两个也行3.0的,具体可以进入这个包里看
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
注解和访问地址 变更
由之前的 @EnableSwagger2 更改为 @EnableOpenApi,当然@EnableOpenAp可以放在配置类,也可以放在启动类上,项目访问地址从2.x的 http://localhost:8088/swagger-ui.html 到 3.x的 http://localhost:8088/swagger-ui/index.html 或 http://localhost:8088/swagger-ui/
注:@EnableSwagger2在springfox3版本依然可以继续使用
DocumentationType 变更
Docket构造函数中的DocumentationType指向更改:由之前的DocumentationType.SWAGGER_2 更改为 DocumentationType.OAS_30
注:DocumentationType.SWAGGER_2在springfox3版本依然可以继续使用
@Bean
public Docket createDocApi() {
return new Docket(DocumentationType.OAS_30)
.enable(swaggerProperties.getEnabled())
.apiInfo(buildApiInfo(swaggerProperties.getDocketConfig()))
.select()
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getDocketConfig().getBa