刷新Spring的属性占位符机制

我有一个Spring上下文xml文件和一个由PropertyPlaceholderConfigurer机制创建的特定bean。 我的问题是:当应用程序正在运行相关的属性文件更改时,我不想重启应用程序。 我想重新加载相关的bean没有重启应用程序。

什么是我的目标的最佳解决方案?

你可以看看github上的ReloadablePropertiesAnnotation https://github.com/jamesemorgan/ReloadablePropertiesAnnotation

这应该只是通过注释你的财产来工作

 @ReloadableProperty("dynamicProperty.myProperty") private String myProperty; 

你必须添加一些弹簧配置以及在github上或在这个博客中的示例http://www.morgan-design.com/2012/08/reloadable-application-properties-with.html

在引擎盖下,这是使用Guava的EventBus在创建bean之后更新bean的属性。