I am a begginer in Spring and encountered the following problem.
I have the following files:
app.properties
applicationContext.xml
web.xml
Within app.properties
I have the value app.env=dev
In applicationContext.xml
:
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
<property name="ignoreResourceNotFound" value="true" />
<property name="location">
<value>app.properties</value>
</property>
</bean>
I want to use the app.env
from the properties file in web.xml
like this:
<context-param>
<param-name>ENV</param-name>
<param-value>${app.env}</param-value>
</context-param>
I am using ${app.env}
without problems in applicationContext.xml
.
I have found discussions that state you can push values into web.xml
from a properties file but I have also found people saying it is not possible (usually older posts).
The issue is the placeholder ${app.env}
in web.xml
is not replaced by the value from the properties file. Is it possible to do it? If so what am I missing.