我开始学习spring boot,我刚刚在我的pom.xml中导入了我的弹簧驱动器。现在,端点
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>非常感谢!
发布于 2021-09-18 11:09:44
在我使用的Spring Boot版本中,端点/acturator/info似乎没有像在spring-boot的早期版本中那样默认公开。
为了公开它,我添加了以下条目
management.endpoints.web.exposure.include=*在我的
application.properties文件,并且它起作用了。
亲切的问候,亚历克斯
https://stackoverflow.com/questions/69234068
复制相似问题