Spring Boot Actuator不适用于 rest-full 应用程序,在浏览器上获取 Whitelabel 错误页面,在控制台日志中出现以下错误。
org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /actuator/health
在 Maven 依赖项下添加。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Spring Boot 应用程序版本
<version>2.4.1</version>
在 application.properties 文件中添加了属性
management.endpoints.enabled-by-default=true
management.endpoint.info.enabled=true
management.security.enabled=false
management.endpoints.web.exposure.include=*
spring.mvc.throw-exception-if-no-handler-found=true
无法使用以下 URL 访问执行器
http://localhost:8090/actuator/health
http://localhost:8090/actuator/
http://localhost:8090/health/
日志
WARN IN-WKS-435 [nio-8090-exec-1] o.s.w.s.PageNotFound : No mapping for GET /actuator/health
WARN IN-WKS-435 [nio-8090-exec-1] o.s.w.s.PageNotFound : No handler found for GET /actuator/health
WARN IN-WKS-435 [nio-8090-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /actuator/health]
注意:除此之外,整个应用程序运行良好。
请建议我是否需要在我们的应用程序中添加任何其他配置。