I am currently developing a web application. I know some of the basics of Spring, however I have not worked with it so much, so I decided to improve my Spring-skills, and I had a problem that I can not find a good solution for.
I would like to implement a function in my application that will allow the user to configure everything without touching any configuration file (for example, spring beans), basically the person who wants to deploy, run and use the application should only copy the .WAR file to, for example , tomcat, and all configuration must be done in the application (for example, in OpenFire).
So, I assume that the user deploys the application to a specific URL, and everything is done through the user interface, he is asked about some parameters (for example, information about connecting to the database), after all the data is given, everything is stored in the cfg file, the application is restarted and the configuration process is completed.
I wanted to have all the configuration details in spring beans, but I found that I cannot change them programmatically (one solution would be to change the file "from spring" and reload the application context after trusteeship - is this a good approach?). Another option is to store the XML file in WEB-INF, for example, and save the data there when it is collected from the user, but how to load the data from the bean file into the application context?
Any tips appriciated!
source share