Arg*_*gos 10 swagger spring-boot spring-boot-actuator
我正在使用Spring Boot应用程序,我使用Swagger作为文档.
我在我的应用程序中添加了Spring Boot Actuator,但现在我想在我的swagger文档中添加由执行器创建的新服务(/ health/metrics ..).
我没有找到如何配置Actuator和Swagger.
为了在springdoc-openapispring-boot-actuator中显示端点,只需添加以下属性:
springdoc.show-actuator=true
Run Code Online (Sandbox Code Playgroud)
您可以在Swagger中配置要添加到文档中的路径.
@Bean
public Docket appApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
...
}
Run Code Online (Sandbox Code Playgroud)
将显示所有可用的端点.
@Bean
public Docket appApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
...
}
Run Code Online (Sandbox Code Playgroud)
将仅限于公开的端点 .paths(PathSelectors.any("/mypath/**"))
| 归档时间: |
|
| 查看次数: |
7878 次 |
| 最近记录: |