How to update earlier @Autowiredspring 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 using the new configuration, but all objects @Autowiredstill contain old values
Is there any solution for updating spring objects?
source
share