首页 > 解决方案 > 在 Spring Boot 应用程序中更新底层依赖 bean 时刷新 bean

问题描述

我有一个配置如下:

@Configuration
public class REConfiguration {

  private final DBRuleLoader dbRuleLoader;

  
  public REConfiguration(
      DBRuleLoader dbRuleLoader) {
    this.dbRuleLoader = dbRuleLoader;
  }

  
  @RefreshScope
  @Bean
  public REMgr ruleEngine() {
    return REmgrFactory.getREMgr(this.dbRuleLoader);
  }

}

实际上,我在@RefreshScope这里添加了,因为我希望对底层DBRuleLoaderbean的任何更新REMgr都进行刷新。我不确定它是否真的有效。

标签: javaspringspring-bootspring-cloud

解决方案


推荐阅读