spring-boot-starter-actuator /info获取空信息

  用了spring-boot-starter-actuator,在监控页面对应服务中显示空值,下面是正常情况下有的值

pom配置了

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <finalName>${project.name}</finalName>
                </configuration>
            </plugin>
        </plugins>
</build>

 health配置,防止actuator提供默认端点无返回数据或显示错误页面:

#监控短点配置
management:
  security:
    enabled: false
endpoints:
  actuator:
    enabled: true
  shutdown:
    enabled: false

网上关于此问题的很少,因此找了国内外的一些文章,最终有一篇文章中指出了spring-boot-starter-actuator的源码解释:

参考源:https://blog.csdn.net/qq_26000415/article/details/79234812

到生成的target中发现真的没有这个文件,因此下步就是怎么生成这个build-info,打开idea的如下图位置,运行:

 

spring-boot:build-info,生成Actuator使用的构建信息文件build-info.properties

然后再看就有此文件了,接下来就是再次正常打包就行了。

 

posted @ 2018-07-10 17:35  欢醉  阅读(2320)  评论(2编辑  收藏  举报