如何使用注释向Swagger 添加Spring Security身份验证?
我的SwaggerConfig
就像:
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Spring REST Sample with Swagger")
.description("Spring REST Sample with Swagger").license("Apache License Version 2.0").version("1.0")
.build();
}
@Bean
public Docket docket() {
Docket docket = new Docket(DocumentationType.SWAGGER_2);
docket.protocols(new HashSet<String>(Arrays.asList("http")));
docket.apiInfo(apiInfo()).select()
.apis(RequestHandlerSelectors.basePackage("com.zycus.endpoint"))
.paths(PathSelectors.any()).build();
return docket;
}