我有一个带有 Spring Boot 2 的微服务应用程序,它使用我自己的库通过执行器功能将新端点传播到自身 - 我自己的执行器实现了 MvcEndpoint 接口,并包含从 application.yml 获取真实 API 映射的“路径”变量使用这个库的微服务。
但是在我将我的库重新编码为 Spring Boot 2 之后,我遇到了一个问题 - @Endpoint注释上的id属性仅包含常量值(作为每个注释属性),并且我还没有找到将执行器端点的 API 路径更改为某些东西的方法像' /api/v1/my-service/my-actuator-endpoint '。
我试图在我的微服务 application.yml 中写这个:
endpoints:
my-actuator-endpoint:
path: /api/v1/my-service/my-actuator-endpoint
但是这个端点仍然只能从 /my-actuator-endpoint 访问,这意味着只能通过它的 id。
如何通过 /api/v1/my-service/my-actuator-endpoint 等自定义路径访问它,该路径将在 application.yml 中配置?