6、在需要自动刷新配置的类上(在order服务的controller上)加注解@RefreshScope(完成就可以自动刷新配置了)。
7、远程git仓库改完配置后,需要调用config-server的bus-refresh接口才会生效,两种方式
- 码云开源中国跟springcloud的config还没兼容。先在github上面在项目的settings的webhook目录中把config的服务器地址加上monitor。
<!-- Config Server --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-monitor</artifactId> </dependency>
- Ps:Config Server 专门提供了 monitor 组件,Config Client 上是没有的噢。
8、这样下来,git 上面配置无论再怎么修改,都可以统一自动刷新并同步啦。
附
- 目前所兼容Spring Cloud & Webhook的Git仓库。


