How can I refresh previously @Autowired
spring objects after dynamic configuration changes?
// 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);
With myApplicationContextAware.applicationContext.getBean(MyClass.class)
I can get new instances by new configuration, but all @Autowired
objects still contain old values
Is there any solution to refresh spring objects?