弹簧致动器“/执行器”端点不可用

时间:2017-06-10 13:06:02

标签: spring spring-mvc spring-boot spring-boot-actuator

我创建了一个简单的示例项目,只有弹簧网和弹簧执行器。我无法在此项目中调用/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

任何建议都会很好。提前谢谢。

2 个答案:

答案 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-actuatorspring-boot-actuator-autoconfigure,但是没有用。请注意包装中的 starter 一词。这将是您使它起作用所需的最细微的改变。