New to Spring-MVC.
I want to store two properties (uploadFolder=.., downloadFolder=..) in a .properties file and access it in HomeController class (automatically created
1) Better way is by using src/main/resources
2) yes, but this messages
have different purpose
3)
One way to make a bean from the properties file in src/main/resources
:
/WEB-INF/classes/folders.properties
And in your controller simply inject the reference.
Here how your controller will look like, the xml:
...
The controller class, related part:
public class MyController extends ... {
private Properties foldersConfig;
public void setFoldersConfig(Properties config) {
this.foldersConfig = config;
}
}
4) You can access if you put the properties in the View - Model, but this not good solution. Take what you need in the controller (the paths) and put it in the result.