-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Provide a property to disable the /actuator
discovery page
#24693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Disabling the endpoints by default has no effect as There's no property to allow you to disable it at the moment, but it is possible to do so by defining your own bean. For example, if you're using the Servlet web stack and Spring MVC, you'd define a bean that's a copy-paste of the @Bean
@ConditionalOnMissingBean
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier,
ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier,
EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties,
WebEndpointProperties webEndpointProperties, Environment environment) {
List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
allEndpoints.addAll(webEndpoints);
allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
String basePath = webEndpointProperties.getBasePath();
EndpointMapping endpointMapping = new EndpointMapping(basePath);
boolean shouldRegisterLinksMapping = StringUtils.hasText(basePath)
|| ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT);
return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes,
corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath),
shouldRegisterLinksMapping);
} We can consider adding a property to avoid the need for copy-paste. |
/actuator
discovery page/actuator
discovery page
@wilkinsona Thanks for the solution. With that said, I'd love if it were as easy as setting a property 🙂 I think that if all of the endpoints are disabled then |
We're going to add a property so that the links can be easily switched off. |
Thank you 👍 |
If I include
spring-boot-starter-actuator
there is no way for me to disable the discovery page (/actuator
).I would like to utilize other features of the actuator, such as metrics, but I do not want to be forced into exposing this endpoint.
I can disable all other endpoints with the following:
I would think this would also disable the
/actuator
endpoint.The text was updated successfully, but these errors were encountered: