无法使用Spring Cloud ContextRefresh重新绑定JHipsterProperties属性
我有一段代码可以在JHipster应用程序中自动重新加载配置属性。 许多@ConfigurationProperties注释的bean都得到了很好的刷新,但JHipsterProperties bean没有 通过Sring云上下文的ConfigurationPropertiesBeans,JHipsterProperties bean是未知的,我无法理解为什么 解决方案是将缺少的@ConfigurationProperties bean添加到ConfigurationPropertiesBeans中,但这只是一个丑陋的解决方法无法使用Spring Cloud ContextRefresh重新绑定JHipsterProperties属性,jhipster,spring-cloud,Jhipster,Spring Cloud,我有一段代码可以在JHipster应用程序中自动重新加载配置属性。 许多@ConfigurationProperties注释的bean都得到了很好的刷新,但JHipsterProperties bean没有 通过Sring云上下文的ConfigurationPropertiesBeans,JHipsterProperties bean是未知的,我无法理解为什么 解决方案是将缺少的@ConfigurationProperties bean添加到ConfigurationPropertiesBean
public void triggerReload() throws IOException {
LOG.info("Reloading configuration");
try {
this.contextRefresher.refresh();
} catch (final BeanCreationException e) {
// DO SOMETHING USEFUL
}
LOG.info(this.jHipsterProperties.getMail().getFrom()); // <--- value is not updated
LOG.info(this.mailProperties.getHost()); // <--- value is updated
}
public void triggerload()引发IOException{
LOG.info(“重新加载配置”);
试一试{
this.contextRefresh.refresh();
}捕获(最终BeanCreationException e){
//做些有用的事
}
LOG.info(this.jhipsterpreproperties.getMail().getFrom())//