'Is that possible that we use spring actuator inside a spring MVC application and then change the managenement endpoint base path
I have successfully created Spring Actuator endpoints by injecting beans provided by Spring Actuator dependencies. But now I need to change the base path of the management endpoints to other endpoint pattern "/internal", But this is a Spring MVC application, I can't directly do it using application.properties file as we do in original spring boot appliation (management.endpoints.web.base-path=/custom-ednpoint). Is this operation permissible for Actuator running spring MVC app?
@Configuration
@EnableWebMvc
@Import({EndpointAutoConfiguration.class,
PublicMetricsAutoConfiguration.class,
HealthIndicatorAutoConfiguration.class,
})
@ComponentScan({"com.content.server"})
public class ActuatorConfiguration {
@Bean
@Autowired
public EndpointHandlerMapping endpointHandlerMapping(
Collection<? extends MvcEndpoint> endpoints
) {
return new EndpointHandlerMapping(endpoints);
}
@Bean
@Autowired
public EndpointMvcAdapter infoMvcEndPoint(InfoEndpoint delegate) {
return new EndpointMvcAdapter(delegate);
}
@Bean
@Autowired
public EndpointMvcAdapter beansEndPoint(BeansEndpoint delegate) {
return new EndpointMvcAdapter(delegate);
}
@Bean
@Autowired
public EndpointMvcAdapter dumpEndPoint(DumpEndpoint delegate) {
return new EndpointMvcAdapter(delegate);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
