springboot查看系统所有的bean

我是要查多数据源是否被创建bean才用到的,记录下

1、确保依赖

       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

2、开放端口

management:
  endpoints:
    web:
      exposure:
        include: "*"

3、访问地址,如果系统有自定义的认证体系也需要放开该路径

server:
  port: 8866 
  servlet:
    context-path: /

如果你的端口和根是上述配置,就可以这样访问

http://localhost:8866/actuator/beans

返回报文就是所有的bean

其他功能请访问http://localhost:8866/actuator

会返回所有的功能接口

{
       "_links" :   {
             "beans" :   {
                   "href" :   "http://localhost:8866/actuator/beans"  ,
                   "templated" :   false
             }  ,
             "caches" :   {
                   "href" :   "http://localhost:8866/actuator/caches"  ,
                   "templated" :   false
             }  ,
             "caches-cache" :   {
                   "href" :   "http://localhost:8866/actuator/caches/{cache}"  ,
                   "templated" :   true
             }  ,
             "conditions" :   {
                   "href" :   "http://localhost:8866/actuator/conditions"  ,
                   "templated" :   false
             }  ,
             "configprops" :   {
                   "href" :   "http://localhost:8866/actuator/configprops"  ,
                   "templated" :   false
             }  ,
             "env" :   {
                   "href" :   "http://localhost:8866/actuator/env"  ,
                   "templated" :   false
             }  ,
             "env-toMatch" :   {
                   "href" :   "http://localhost:8866/actuator/env/{toMatch}"  ,
                   "templated" :   true
             }  ,
             "health" :   {
                   "href" :   "http://localhost:8866/actuator/health"  ,
                   "templated" :   false
             }  ,
             "health-path" :   {
                   "href" :   "http://localhost:8866/actuator/health/{*path}"  ,
                   "templated" :   true
             }  ,
             "heapdump" :   {
                   "href" :   "http://localhost:8866/actuator/heapdump"  ,
                   "templated" :   false
             }  ,
             "info" :   {
                   "href" :   "http://localhost:8866/actuator/info"  ,
                   "templated" :   false
             }  ,
             "loggers" :   {
                   "href" :   "http://localhost:8866/actuator/loggers"  ,
                   "templated" :   false
             }  ,
             "loggers-name" :   {
                   "href" :   "http://localhost:8866/actuator/loggers/{name}"  ,
                   "templated" :   true
             }  ,
             "mappings" :   {
                   "href" :   "http://localhost:8866/actuator/mappings"  ,
                   "templated" :   false
             }  ,
             "metrics" :   {
                   "href" :   "http://localhost:8866/actuator/metrics"  ,
                   "templated" :   false
             }  ,
             "metrics-requiredMetricName" :   {
                   "href" :   "http://localhost:8866/actuator/metrics/{requiredMetricName}"  ,
                   "templated" :   true
             }  ,
             "scheduledtasks" :   {
                   "href" :   "http://localhost:8866/actuator/scheduledtasks"  ,
                   "templated" :   false
             }  ,
             "self" :   {
                   "href" :   "http://localhost:8866/actuator"  ,
                   "templated" :   false
             }  ,
             "threaddump" :   {
                   "href" :   "http://localhost:8866/actuator/threaddump"  ,
                   "templated" :   false
             }
       }
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值