I have been successful in loading the mule app properties from the database at app init and setting them to the property placeholders of mule flows. The code for this is referenced here Read mule props from the DB
However, this works only during app startup. I want to be able to modify the properties in the database(which I can) and make it reflect on the mule flows at runtime without restarting the mule server.
To acheive this, I created a new flow with a Http Listener which invokes a java class that reads the properties from the database and tries to set it to bean factory using the PropertySourcesPlaceHolderConfigurer class. The sample code of the java class looks like this.
@Autowired
ConfigurableListableBeanFactory configurableListableBeanFactory;
@Autowired
MyService myService;
public MuleEventContext onCall(MuleEventContext eventContext){
Properties properties = new Properties();
// get properties from the database
Map<String,String> propertiesMap = getMuleAppPropertiesFromDB();
if(null != propertiesMap && !CollectionUtilsIntg.isEmpty(propertiesMap))
properties.putAll(propertiesMap);
PropertySourcesPlaceholderConfigurer cfg = new PropertySourcesPlaceholderConfigurer();
cfg.setProperties(properties);
cfg.postProcessBeanFactory(configurableListableBeanFactory);
}
This code ran succesfully but failed to set the properties to the mule app flows at runtime.
Does anyone have any idea how else this can be achieved?
Please help