弹簧靴执行器“/health"不工作 [英] Spring boot actuator "/health" is not working
问题描述
我有一个正在运行的 Springboot 应用程序,它为 URL http://localhost:8081/topics
提供服务并按预期返回 JSON 响应.
I have a running Springboot application which serves the URL http://localhost:8081/topics
and returns me JSON response as expected.
我添加了执行器依赖<代码><依赖><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId><范围>测试</范围></dependency>
按照教程
但是当我点击 http://localhost:8081/health
时,它没有给出预期的结果.它说
But when I hit http://localhost:8081/health
it does not give expected result. It says
<代码>{时间戳":1497952368055,状态":404,"错误": "未找到","message": "没有可用的消息",路径":/健康"}
Spring 启动版本是 1.5.4.RELEASE.和 Java 1.8我需要做哪些额外的设置?
Spring boot version is 1.5.4.RELEASE. And Java 1.8 What additional settings do I need to do ?
推荐答案
在你已经声明的依赖项
<scope>test</scope>
意思是
测试
这个范围表示正常不需要依赖应用程序的使用,仅可用于测试编译和执行阶段.
This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.
如果您希望它可用于应用程序的正常使用,请删除
或将其更改为
>
If you want it available for normal use of the application remove <scope>test</scope>
or change it to <scope>compile</scope>
这篇关于弹簧靴执行器“/health"不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!