1. springcloud1.5.x的消息总线配置是git
# RabbitMq的地址、端口,用户名、密码 spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 spring.rabbitmq.username=guest spring.rabbitmq.password=guest # 保证调用 /bus/refresh的时候不须要验证 management.security.enabled=false
configServer的启动类加上注解@RefreshScope
github
configClient的启动类也加上注解@RefreshScopeweb
修改github上的配置文件以后,打开postman,请求方式是post,地址是http://localhost:8881/bus/refresh,这个端口号是configServer的。spring
请求成功以后,返回的是空白,此时configClient就能获取到最新的配置信息。post
2. springcloud2.x的消息总线配置是spa
# RabbitMq的地址、端口,用户名、密码 spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 spring.rabbitmq.username=guest spring.rabbitmq.password=guest # 刷新配置,在spring boot 2.x 以前1.x的management.security.enabled失效,新的配置为 management.endpoints.web.exposure.include=bus-refresh
configServer的启动类加上注解@RefreshScope
code
configClient的启动类也加上注解@RefreshScopeblog
修改github上的配置文件以后,打开postman,请求方式是post,地址是http://localhost:8881/actuator/bus-refresh,这个端口号是configServer的。rabbitmq
请求成功以后,返回的是空白,此时configClient就能获取到最新的配置信息。springcloud
3. 须要注意的是configClient也要配置RabbiMq。