How do I expose Actuator endpoints in Swagger UI? I hoped I could just flip the show-actuator flag
springdoc:
swagger-ui:
enabled: true
path: /swagger-ui
config-url: /swagger-ui/config
show-actuator: true
but doing so creates a circular dependency on start-up (everything works great without the flag)
ERROR 10972 --- [dynamic-gateway] [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
org.springframework.security.config.annotation.web.reactive.ServerHttpSecurityConfiguration
┌─────┐
| org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration$EnableWebFluxConfiguration
↑ ↓
| swaggerWebFluxConfigurer defined in class path resource [org/springdoc/webflux/ui/SwaggerConfig.class]
↑ ↓
| actuatorProvider defined in class path resource [org/springdoc/webflux/core/configuration/SpringDocWebFluxConfiguration$SpringDocWebFluxActuatorConfiguration.class]
↑ ↓
| webEndpointReactiveHandlerMapping defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/reactive/WebFluxEndpointManagementContextConfiguration.class]
↑ ↓
| gatewayControllerEndpoint defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration$GatewayActuatorConfiguration.class]
↑ ↓
| modifyRequestBodyGatewayFilterFactory defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]
└─────┘
My related dependencies:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!-- ... -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
the error message states a circular dependency with spring cloud gateway and spring security. I build a small app that is using webflux with springdoc and actuator and it works just fine.
I assume there is some other configuration that is interfering on your side. Maybe you can give more information about your security and gateway config.