【发布时间】:2019-12-25 23:25:29
【问题描述】:
我有一个 Camel Spring Boot 应用程序,我在其中打印使用 Spring Cloud Config Server 设置的属性的值(通过 Git commit id 插件)。问题在于,一旦将值提交给 Git,Camel 应用程序中的属性值就不会更新。我必须重新启动无法达到 Spring Cloud Config 服务器目的的 Camel 应用程序。请注意,我们在本地机器上使用 Git 文件系统。
属性文件的名称是 CamelSpringBootSample-dev.properties。
只要我提交,配置服务器就会在刷新时在端点发布更新的值: http://localhost:8888/CamelSpringBootSample/dev
我还在以下位置提供了 Camel 应用程序端点: http://localhost:8181/actuator/env
这里的属性值不会在刷新时更新。但是,如果我重新启动 Camel 应用程序,则该值正在反映。
三个项目的源代码都上传到github.com。
Camel 客户端项目(使用配置服务器自行配置):https://github.com/sreejeshraj/camel-config-server 请不要被存储库名称 camel-config-server 误导。这是配置服务器的客户端,不小心命名错误,见谅。
- 存储配置属性的本地git仓库:https://github.com/sreejeshraj/Git-Config
请注意,我在 Spring bean 组件类中使用了注解 @RefreshScope。
你能帮我解决这个问题吗?提前致谢。
【问题讨论】:
-
你能编辑你的问题和用
@RefreshScope注释的bean的代码吗? -
@RefreshScope 注解的 bean 可在github.com/sreejeshraj/camel-config-server/blob/master/src/main/…获得
标签: spring-boot apache-camel spring-cloud-config