I am running my springboot application by setting context-path to /myservice. This results into appending all my actuator endpoints exposed at the URL- http://localhost:8080/myservice/actuator/, while I want only http://localhost:8080/actuator/. Is there a way to tell the springboot to ignore appending context path to actuator endpoints (through DispatcherServlet or CXFServlet or anything) Please help.
Unfortunately this is not possible.
From the documentation:
Unless the management port has been configured to expose endpoints by using a different HTTP port, management.endpoints.web.base-path is relative to server.servlet.context-path (Servlet web applications) or spring.webflux.base-path (reactive web applications). If management.server.port is configured, management.endpoints.web.base-path is relative to management.server.base-path.
What you could do is to use a different port for the management endpoints.
management.server.port=8081
Then you will get http://localhost:8081/actuator
Technically it is not possible because spring boot has only one DispatcherServlet
which is a front controller, if you want two different paths then you can use @RequestMapping
annotation on two different controllers`
Still of you want two different context-paths then you should have two DispatcherServlet's
© 2022 - 2024 — McMap. All rights reserved.