在Spring boot
升级到2.0
以后actuator
也跟随升级
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
如果采用原来的的方式直接访问actuator
暴露的接口将会保错,如访问health
的接口,检查服务是否正常。
http://host:port/health
得到下面响应
{
"timestamp": "....",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/health"
}
这是因为Spring boot 2.0
中actuator
的接口被增加了前缀路径 /actuator
所以只需要在原有的接口上加上/actuator
前缀就可以
关于这个问题可以在启动Spring boot的日志中发现