1) It is best to use src/main/resources
2) yes, but this messages
has a different purpose
3)
One way to make a bean from a properties file in src/main/resources
:
<bean id="foldersConfig" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="location" > <value>/WEB-INF/classes/folders.properties</value> </property> </bean>
And in your controller just enter the link.
Here is what your controller looks like, xml:
<bean id="myController" class="my.project.package.controller.MyController"> ... <property name="foldersConfig" ref="foldersConfig" /> </bean>
Controller class related part:
public class MyController extends ... { private Properties foldersConfig; public void setFoldersConfig(Properties config) { this.foldersConfig = config; } }
4) You can access it if you put properties in the View-Model, but this is not a good solution. Take what you need in the controller (path) and put it in the result.
source share