## springCloud config refresh刷新actuator踩坑

refresh刷新不起作用 404 actuator踩坑

Actuator

actuator是springboot中的一个附加功能,官方是对它这样介绍的:

Spring Boot includes a number of additional features to help you monitor and manage your application when you push it to production. You can choose to manage and monitor your application by using HTTP endpoints or with JMX. Auditing, health, and metrics gathering can also be automatically applied to your application.

用法:

1.引入依赖:

Maven方式:

org.springframework.boot spring-boot-starter-actuator

2 加配置(敲黑板

management:  #actuator
  server:
    port: 8081
  endpoints:
    web:
#      base-path: / #默认是/actuator 前缀,可以在这里修改
      exposure:
        include: "*"  #打开全部请求端点
#        include: refresh,health,info #打开部分

必须加上启动端口 2.0以后不加上启动端口报404

management:  #actuator
  server:
    port: 8081

3 加注解

@RefreshScope

4 手动刷新(敲黑板,搞了一上午没吃饭

2.0之前

curl -X POST http://localhost:1031/refresh
curl -X POST “http://localhost:1031/bus/refresh

2.0之以后

curl -v -X POST “http://localhost:8081/actuator/bus-refresh
curl -X POST “http://localhost:8081/actuator/bus-refresh
在这里插入图片描述
纯手打请给与支持

发布了38 篇原创文章 · 获赞 26 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/sdrfengmi/article/details/86622556