I've created a spring boot application and it has ServletRegistrationBean:
@Bean
public ServletRegistrationBean<DispatcherServlet> restApi() {
final DispatcherServlet dispatcherServlet = new DispatcherServlet(webApplicationContext);
final ServletRegistrationBean<DispatcherServlet> servletRegistrationBean = new ServletRegistrationBean<>(dispatcherServlet, "/api/*");
servletRegistrationBean.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
return servletRegistrationBean;
}
and I want to set base path for Actuator as "/api":
management.endpoints.web.base-path=/api
management.endpoint.health.enabled=true
management.endpoints.enabled-by-default=false
management.endpoints.web.path-mapping.health=/v1/health
But this doesn't work. For any else base path it works correctly {{localhost}}/api GET returns list of endpoints, but {{localhost}}/api/v1/health GET returns 404
my other rest API which starts with "/api/v1/" work fine So is there a way how set identical base path for rest API and Actuator endpoints?