4
動的コンフィグレーションの変更後に以前に@Autowired
スプリングオブジェクトをリフレッシュするにはどうすればよいですか? myApplicationContextAware.applicationContext.getBean(MyClass.class)
で新しい設定を行った後、どのようにすべてのスプリングオブジェクトを更新できますか?
// Here is my updateConfig method
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(new ClassPathResource("applicationContext.xml"));
context.refresh();
myApplicationContextAware.setApplicationContext(context);
私は新しい設定で新しいインスタンスを取得することができますが、すべての@Autowired
のオブジェクトがまだ古い値
が含まれている春のオブジェクトをリフレッシュするために任意の解決策はありますか?
春のブーツは完璧に動作します、ありがとうございます! そうでなければ、AbstractRefreshableApplicationContextは私のためには機能しませんが、新しい設定をロードしますが、最初のautowired beanには古い値が含まれています。 – oedural
確認していただき、ありがとうございます。 – 11thdimension