Reputation: 433
I am trying to load dynamic values from properties file into a Bean Class (Spring MVC project).
I had used following tags to load values.
<context:property-placeholder
location="file:/home/java/examresults/departments.properties"
ignore-unresolvable="true" order="2"/>`
But changing the value in properties file after starting the application, it does not reflected at the form.
I am injecting these values into a class using following declaration.
<bean id="beanmessage" class="examresults.bean.MessageClass" scope="prototype">
<property name="imagelocation" value="/home/java/examresults/"/>
<property name="boards" value="${boardvalue}"/>
<property name="departments" value="${deptvalue}"/>
</bean>
Hence, I am not able to fully utilizing the properties file in my Spring MVC Application.
Upvotes: 0
Views: 824
Reputation: 2299
If you modify the properties file, the webserver needs to be reloaded to make the changes reflected.
When a webserver start, it will instantiate all the registered bean with the configured properties. So if you made changes to the configuration after the webserver started, the bean doesn't know about the changed configuration, because it's already instantiated in the application context / IoC container.
To make the changes in properties files reflected is done by restarting / reloading the webserver (either tomcat or jetty).
Upvotes: 1