In my case, I had the spring-boot-starter-actuator
dependency, but did not have the spring-boot-starter-web
one - in a refactor, I thought it would not be needed as my application can run with spring.main.web-application-type: none
.
But that's not the case: turns out that if you set the web-application-type
property to none
and remove the spring-boot-starter-web
depdendency (after all, your application logic doesn't need any webserver running), the health endpoints will not be initialized (if you search in the application initialization logs, you will never find anything like
[main] INFO o.s.b.a.e.web.EndpointLinksResolver - Exposing *X* endpoints beneath base path '/actuator'
where X is the number of endpoints you defined in management.endpoints.web.exposure.include
.
This is super annoying, because in my assumption the health endpoints would enable a web server automatically, if needed.
So, my solution was adding:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
</dependency>
back to my pom.xml
, and live with the fact that my application runs a webserver only to expose those endpoints.