404找不到localhost:8080 /执行器

时间:2017-02-03 18:52:04

标签: java spring spring-boot spring-boot-actuator

我用web&创建了一个简单的Boot应用程序。执行器依赖性 我无法获得localhost:8080/actuator并在浏览器中收到以下错误:

  

Whitelabel错误页面    :这个应用程序没有/ error的显式映射,所以你是       将此视为后备。       星期五2月03日19:02:01 CET 2017       出现意外错误(type = Not Found,status = 404)。       没有可用的消息

1 个答案:

答案 0 :(得分:2)

正如Spring Boot documentation所述,/actuator终点:

  

为其他端点提供基于超媒体的“发现页面”。   要求Spring HATEOAS位于类路径

因此,您应该添加spring-boot-starter-hateoas启动程序包,以使/actuator端点正常工作。例如,如果您使用的是Gradle:

dependencies {
    // web and actuator and others
    compile 'org.springframework.boot:spring-boot-starter-hateoas'
}

另外,您应将endpoints.hypermedia.enabled属性设置为truedocumentation说:

  

如果endpoints.hypermedia.enabled设置为true和Spring HATEOAS   在类路径上(例如通过spring-boot-starter-hateoas或   如果你使用的是Spring Data REST)那么来自的HTTP端点   通过超媒体链接增强了执行器,并且“发现页面”是   添加了指向所有端点的链接。 “发现页面”是   默认情况下在/actuator上可用。