我创建了一个带有网络和执行器依赖项的简单启动应用程序 我无法获取 localhost:8080/actuator 并在浏览器中收到以下错误:
Whitelabel Error Page : This application has no explicit mapping for /error, so you are seeing this as a fallback. Fri Feb 03 19:02:01 CET 2017 There was an unexpected error (type=Not Found, status=404). No message available
最佳答案
作为Spring Boot documentation状态,/actuator
端点:
Provides a hypermedia-based “discovery page” for the other endpoints. Requires Spring HATEOAS to be on the classpath.
因此,您应该添加 spring-boot-starter-hateoas
启动程序包以使 /actuator
端点正常工作。例如,如果您使用 Gradle:
dependencies {
// web and actuator and others
compile 'org.springframework.boot:spring-boot-starter-hateoas'
}
此外,您还应该将 endpoints.hypermedia.enabled
属性设置为 true
,如 documentation说:
If
endpoints.hypermedia.enabled
is set totrue
and Spring HATEOAS is on the classpath (e.g. through thespring-boot-starter-hateoas
or if you are using Spring Data REST) then the HTTP endpoints from the Actuator are enhanced with hypermedia links, and a “discovery page” is added with links to all the endpoints. The “discovery page” is available on/actuator
by default.
关于java - 404 未找到本地主机 :8080/actuator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42031138/