Skip to content

In a non-reactive application, health indicators in a parent context are not found #27308

Closed
@ryanjbaxter

Description

@ryanjbaxter

I was debugging an issue related to disabling HealthIndicators last week and noticed that Boot fetches the health indicators differently in the reactive case

The non-reactive configuration fetched the beans through the application context
https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.java#L81

The reactive implementation has them injected
https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthEndpointConfiguration.java#L48

The reason this caught my eye is because we had a case where a HealthIndicator was being created in the bootstrap context and if spring-boot-starter-web was being used it did not get created if it was disabled in application.properties. However when spring-boot-starter-webflux was used the property had to be put in bootstrap.properties. When you fetch beans from the ApplicationContext as is done in the non-reactive configuration the application hierarchy is not taken into account, so that causes a difference in behavior.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions