我创建了一个简单的示例项目,只有弹簧网和弹簧执行器。我无法在此项目中调用/actuator
端点。我得到的只是404错误:
There was an unexpected error (type=Not Found, status=404).
No message available
在日志中,我看不到任何相关内容。我已激活management.security.enabled=false
中的application.properties
以避免安全问题。
在具有相同弹簧,弹簧腹板和弹簧执行器版本的其他项目中,我到达/actuator
端点,但我看不出差异。
以下是示例项目的github链接:https://github.com/ManuZiD/mzd-actuator
任何建议都会很好。提前谢谢。
答案 0 :(得分:4)
/actuator
要求HATEOAS位于类路径上,查看您不在的示例项目,其他执行器端点不需要它(或具有不同的条件依赖性)。您是否尝试/info
验证其他端点是否按预期工作?
激活/actuator
端点添加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html
答案 1 :(得分:1)
就我而言,spring-boot-starter-actuator
解决了该问题。我正在使用spring-boot-actuator
和spring-boot-actuator-autoconfigure
,但是没有用。请注意包装中的 starter 一词。这将是您使它起作用所需的最细微的改变。