java - 404 未找到本地主机 :8080/actuator

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

我创建了一个带有网络和执行器依赖项的简单启动应用程序 我无法获取 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 to true and Spring HATEOAS is on the classpath (e.g. through the spring-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/

相关文章:

java - 如何使用 Android 的 Handler.PostDelayed 使事件在指定时间发生?

Java/Spring 创建新的 ModelAndView,引用发出 get 请求的前一个页面/页面

java - jaxws:endpoint 中的 InstantiationException : java. math.BigDecimal

java - Tomcat 找不到 Spring Controller

html - Angular:当 Assets 文件夹发生变化时防止自动重新编译

java - Eclipse/javac 不同意编译签名与默认方法冲突;谁是对的?

java - 服务类中的 Spring Autowired 异常

java - 如何在 Java 中创建具有用户定义名称的变量?

Spring Boot - 带有独立 tomcat 的自定义 404 页面

java - Springfox 从 2.9.2 更新到 2.10.4 后错误 "Unable to infer base url. ..."