Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Actuator as a groupedOpenApi

Could we add Actuator endpoints as a groupedOpenApi that will be gourped separately ?

ex :

@bean
public GroupedOpenApi actuatorApi() {
return GroupedOpenApi.builder().setGroup("Actuator")
.packagesToScan("org.springframework.boot.actuate")
.pathsToMatch("/actuator/**")
.build();
}

Thanks

like image 492
Yawyaw1 Avatar asked Apr 08 '26 15:04

Yawyaw1


1 Answers

First you need to enable actuator on the swagger-ui:

springdoc.show-actuator=true

You just need to declare GroupedOpenApi bean:

@Bean
 public GroupedOpenApi actuatorApi(){
     String[] paths = {"/actuator/**"};
     return GroupedOpenApi.builder()
             .setGroup("groups")
             .pathsToMatch(paths)
             .build();
 } 

Here are the steps to add actuator:

https://github.com/springdoc/springdoc-openapi-demos/commit/aa6bcf1f0312c8fc36f94aeb4653718b36c308f6

like image 130
brianbro Avatar answered Apr 11 '26 14:04

brianbro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!