OpenApi3.0 Authorization 配置

 @Bean
    public OpenAPI restfulOpenApis() {
        return  new OpenAPI()
                .info(new Info().title("Spring Boot 3.0 Restful Open API")
                        .description("The Open API").version("1.0")
                        .license(new License().name("Apache")))
                        .externalDocs(new ExternalDocumentation()
                        .description("The Open API"))
                .addSecurityItem(new SecurityRequirement().addList("Authorization"))
                .components(new Components().addSecuritySchemes("Authorization",
                        new SecurityScheme().name("Authorization").type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("")));
    }

 

posted @ 2023-01-16 18:03  在 水 一 方  阅读(505)  评论(0编辑  收藏  举报