Shr*_*hal 6 contextpath spring-boot spring-boot-actuator
我通过将上下文路径设置为 /myservice 来运行我的 springboot 应用程序。这会导致附加在 URL- http://localhost:8080/myservice/actuator/ 上公开的所有执行器端点,而我只需要 http://localhost:8080/actuator/。有没有办法告诉 springboot 忽略附加上下文路径到执行器端点(通过 DispatcherServlet 或 CXFServlet 或任何东西)请帮忙。
不幸的是这是不可能的。
从文档中:
除非管理端口已配置为使用不同的 HTTP 端口公开端点,否则 management.endpoints.web.base-path 相对于 server.servlet.context-path (Servlet Web 应用程序)或 spring.webflux.base-path (反应式网络应用程序)。如果配置了management.server.port,则management.endpoints.web.base-path是相对于management.server.base-path的。
您可以做的是为管理端点使用不同的端口。
management.server.port=8081
Run Code Online (Sandbox Code Playgroud)
然后你会得到http://localhost:8081/actuator
| 归档时间: |
|
| 查看次数: |
3293 次 |
| 最近记录: |