为springcloud搭建消息总线完毕访问/bus/refresh报404错误
经过查询发现/bus/refresh是springboot1.xx的写法。
Spring boot 2.0的改动较大,/bus/refresh全部整合到actuador里面了,所以之前1.x的management.security.enabled全部失效,不适用于2.0
适用于2.0的配置是这样的:
management:
endpoints:
web:
exposure:
include: bus-refresh
另外注解
@RefreshScope
需要在配置的页面加上,就是说附带@Value的页面加上此注解
请求刷新的页面由原来1.5.x的localhost:8888/bus/refresh
变成:http://localhost:8888/actuator/bus-refresh
注意:config-server和config-client的配置都得加上
management:
endpoints:
web:
exposure:
include: bus-refresh
本文解决SpringBoot2.0中使用消息总线刷新配置的问题,因SpringBoot2.0对/bus/refresh进行了调整,整合到actuador中。需配置management.endpoints.web.exposure.include为bus-refresh,并在配置类上使用@RefreshScope注解。请求刷新的URL也变为http://localhost:8888/actuator/bus-refresh。
7003

被折叠的 条评论
为什么被折叠?



