springcloud 配置手动推送(改配置不用重启)

1、添加依赖



org.springframework.boot

spring-boot-starter-actuator



2、在bootstrap.yaml下添加配置:(针对spring2.0以上)

management:

    endpoints:

        web:

            exposure:

                include: refresh

            base-path: /

3、在可能需要修改的参数的类(@Value所在的类上)上添加注解:@RefreshScope

 

修改配置后,只需调用一下接口:

curl -X POST http://ip:port/refresh

配置成功刷新

本方法只适用于手动刷新,自动刷新的需集成消息队列

你可能感兴趣的:(一些问题的解决)