Automatic resource reloading in Spring

Is there a way to automatically reload the w760 resource file? I want to find an easy way to change xml configuration at runtime. The Xml file is not in the pathpath folder.

Any ideas?

THX :)

+4
source share
4 answers

If you meant that you want to avoid redeploying your server to change the xml configuration, you can check out JRebel http://zeroturnaround.com/jrebel/ .

+4
source

If this is the application contest that you want to update, use ConfigurableApplicationContext.refresh () or, more specifically, for the web environment, AbstractRefreshableWebApplicationContext , you can see this using the context: property-placeholder.

+2
source

Create your own extension for the ResourceBundle interface and use this to search for your rows instead of Spring. This way you can control things like reboot.

0
source

Yes.

Spring provides a ReloadableResourceBundleMessageSource that can reload a properties file using cacheSeconds . It supports property files in *.properties format and the XML format used by Properties.loadFromXML () .

If your xml file is in other formats, you must make your own resource loader by expanding ReloadableResourceBundleMessageSource and implement your logic to parse the XML file by overriding its loadProperties (resource resource, String file name) .

0
source

Source: https://habr.com/ru/post/1389474/


All Articles