使用springboot+springsecurity+swagger3,访问swagger地址出现异常,具体如下
我有给对应的路径放行
private static final String[] URL={
"/favicon.ico",
"/swagger-ui/**",
"/swagger-resources/**",
"/v2/api-docs",
"/v3/api-docs",
"/webjars/**",
};
.............................
.antMatchers(URL).permitAll()
奇怪的是/v2/api-docs能出来数据,但是/v3/api-docs不能出来数据,为什么
swagger配置类如下
@Configuration
@EnableOpenApi
public class Swagger3 {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.OAS_30)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Spring Boot Swagger3接口文档")
.description("测测测测")
.contact(new Contact("rgh","https://localhost","1111@qq.com"))
.termsOfServiceUrl("https://localhost")
.version("1.0")
.build();
}
}