Open farsunset-com opened 2 weeks ago
The document is not very clear, this is work fine
@Bean
public OpenAPI springDocOpenAPI() {
OpenAPI api = new OpenAPI();
api.components(new Components().addSecuritySchemes("x-token", new SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.in(SecurityScheme.In.HEADER)
.name("x-token")
.description("用户Token")));
api.info(new Info()
.title("Service APIs.")
.description("系统业务接口服务")
.version("3.0.0")
);
api.addSecurityItem(new SecurityRequirement().addList("x-token"));
return api;
}
srpingboot 3.2.5 springdoc 2.6.0
like swagger2