How to read from a properties file in web.xml

in my web.xml . I want to read a welcome file from a properties file something like:

<welcome-file-list> <welcome-file>${home.page}</welcome-file> </welcome-file-list> 

I have a propertyPlaceholderConfigurer :

 <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:messages/application.properties</value> </list> </property> </bean> 

should an additional parameter be added to web.xml, or should another bean be specified or what?

Also I have another xml file at the same web.xml level (in the WEB-INF direclty section) can I read from the properties file in it in the same way?

please inform.

+4
source share
1 answer

This does not work; The web.xml is not fully associated with Spring.

What you can do is have a hard welcome file and redirect to something defined in the Spring configuration inside this file, get the page by grabbing the Spring context manually.

+6
source

All Articles