Hi,
I have a custom actuator endpoint that works perfectly in Spring Boot 3.3.5, but it no longer functions in Spring Boot 3.4.0-RC1 (I have a 404 error because the endpoint is not registered).
I created an example project to demonstrate the issue. The source code is available at this GitHub repository. The main branch uses Spring Boot 3.3.5, while the 3.4.0-RC1_deprecated branch is based on Spring Boot 3.4.0-RC1.
I have also tried the reworked method with access on 3.4.0-RC1_access, but it does not resolve the issue either.
Test results can be found here
The code of the custom actuator endpoint:
@Component
@Endpoint(id = "custom")
public class TestActuatorEndpoint {
@ReadOperation
public String read() {
return "OK";
}
}
The configuration:
spring:
application:
name: testactuator
management:
endpoints:
enabled-by-default: false
web:
exposure:
include: "*"
endpoint:
health:
enabled: true
cors:
allowed-origins: "*"
allowed-methods: GET
Comment From: nicolasb29
It seems that the endpoint isn't invocable because operation was filtered (list is empty) due to this line.
Comment From: philwebb
In Spring Boot 3.3 the management.endpoints.enabled-by-default property was exclusively handled by OnAvailableEndpointCondition, in 3.4 it's handled at a higher level.
We're reading management.endpoints.enabled-by-default=false as a signal to disable any endpoints that haven't been explicitly enabled.
To fix things, you can do the following:
spring:
application:
name: testactuator
management:
endpoints:
enabled-by-default: false
web:
exposure:
include: "*"
endpoint:
health:
enabled: true
custom:
enabled: true
cors:
allowed-origins: "*"
allowed-methods: GET
(or use the new access properties).
I'm not sure if we should treat this as a regression or not. Arguably, it's more consistent the way things are in 3.4.
Comment From: nicolasb29
I had added manually the endpoint and it work well but in my case we have dozens of custom actuators endpoints managed by a team and hundreds of applications using them and managed by a lot developers, so it can be seen as a regression. But I agree with you that it is more comprehensible.
Comment From: wilkinsona
I think we should leave things as-is for 3.4 but update the release notes to call out that enabled-by-default now applies irrespective of the use of @ConditionalOnAvailableEndpoint.
Comment From: wilkinsona
I've added something to the end of this section in the release notes.
Comment From: philwebb
Thanks @wilkinsona, I'm going to close this one.