We were in a similar situation last month where client need update in configuration file in run time.
We created a central Spring component that loads all properties from file using @Value
@Component
public class ConfigurationManagerComponent{
@Value("conf.username")
private String userName;
@Value("conf.email");
private String email;
/*
* All your attributes
*/
//getters and setters
public String getUserName(){
return this.userName;
}
public void setUserName(String userName){
// first set the value to this class (component)
this.userName=userName;
//second save this value in the properties file
//a specific method you have to implement
saveproperties("conf.username",userName);
}
/*
* Do like this for all your getters and setters
*/
}
Then, in any time you need to get or save properties, just inject this component and use its getters and setters
@Autowired
ConfigurationManagerComponent configComponent;
String myActualUserName=configComponent.getUserName();
So then you can get all your data in your controller from config component and set them to your spring model to fill form in webpage, and when saving after edit, you can always use setters of your config component(update class and properties file).
This method is not a standard, just a solution we employed to resolve a problem, it's giving good results right now.
You can also check Apache commons configuration Here for other solutions..
Hope this will help.