Spring Cloud - Eureka /actuator/info 如何显示信息

①在POM文件中添加相关引用

<!-- actuator监控信息完善 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
<!-- 这里可以根据自己的需要,修改匹配规则 -->
     <build>
        <finalName>${project.artifactId}</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <delimiters>
                        <delimit>$</delimit>
                    </delimiters>
                </configuration>
            </plugin>
        </plugins>
    </build>

  ②在属性文件添加

info.app.name=amber-cloud-dept-8001
info.company.name=www.amber.com
info.build.artifactId=$project.artifactId$
info.build.version=$project.version$

 注:如果是YML,则需要做相应的格式调整,如有问题可以把其中$符号可以更换成@试试。

    ③补充

management.endpoints.web.exposure.include=*,hystrix.stream

再访问/actuator/info即可

 

④Endpoint的一些有用的特征

Endpoint IDDescription
auditevents 显示应用暴露的审计事件 (比如认证进入、订单失败)
info 显示应用的基本信息
health 显示应用的健康状态
metrics 显示应用多样的度量信息
loggers 显示和修改配置的loggers
logfile 返回log file中的内容(如果logging.file或者logging.path被设置)
httptrace 显示HTTP足迹,最近100个HTTP request/repsponse
env 显示当前的环境特性
flyway 显示数据库迁移路径的详细信息
liquidbase 显示Liquibase 数据库迁移的纤细信息
shutdown 让你逐步关闭应用
mappings 显示所有的@RequestMapping路径
scheduledtasks 显示应用中的调度任务
threaddump 执行一个线程dump
heapdump 返回一个GZip压缩的JVM堆dump

  

posted @ 2020-03-01 22:31  flycatony  阅读(2295)  评论(0编辑  收藏  举报