how do I dynamically change the properties of a bean at runtime using java spring? I have a bean mainView, which should use as property \"class\" either \"class1\" or \"clas
I believe you can write a class that implements BeanFactoryPostProcessor. If a bean of this class exists in the XML configuration file (alongside your other beans), Spring will automatically call its postProcessBeanFactory(ConfigurableListableBeanFactory) method. The ConfigurableListableBeanFactory object handed to this method can be used to change any bean definitions before Spring goes to work initializing them.