Having a SpringBoot application, where I try to tie my custom HealthCheck to the Spring Liveness probe. Although, it seems not to work. Please see my code below:
@Component
class CustomHealthIndicator() : HealthIndicator {
override fun health(): Health {
Thread.sleep(20000)
return Health.down().build()
}
}
In my application.properties
, I've added my CustomHealthIndicator
to the liveness group like this:
management.endpoint.health.group.liveness.include=livenessState,custom
Through this, I expect, that the livenessState
of my SpringBoot application will report it's status as down
.
Although, it does not seem to work, the status is report as up
.
What am I missing here? I did follow the blog entry here: https://spring.io/blog/2020/03/25/liveness-and-readiness-probes-with-spring-boot and it should work like this, according to the author...
Thanks for any input!