【发布时间】:2021-11-12 23:02:35
【问题描述】:
我开始学习 Spring Boot,我刚刚在我的 pom.xml 中导入了我的 spring-actuator。 现在,端点
http://localhost:8080/actuator/health
工作正常,端点在下面
http://localhost:8080/actuator/
显示以下信息:
{"_links":{"self":{"href":"http://localhost:8080/actuator","templated":false},"health":{"href":"http://localhost:8080/actuator/health","templated":false},"health-path":{"href":"http://localhost:8080/actuator/health/{*path}","templated":true}}}
但是,在文件夹中
src/main/resources
我添加了文件
application.properties
其中包含以下属性:
info.app.name=My Super Cool App
info.app.description=A crazy and fun app, yahoo!
info.app.version=1.0.0
我希望上面提到的属性显示在端点下
http://localhost:8080/actuator/info
但是,上面的端点给了我以下错误消息:
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat Sep 18 13:03:31 CEST 2021
There was an unexpected error (type=Not Found, status=404).
No message available
我的错误在哪里?
下面,你可以从我的 pom.xml 中找到一段摘录:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.luv2code.springboot.demo</groupId>
<artifactId>mycoolap</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mycoolap</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
非常感谢!
【问题讨论】:
标签: java spring-boot spring-boot-actuator