Spring application context : access web.xml context-params?

Yes – ServletContextPropertyPlaceholderConfigurer

This article explains the details. In short, you need:

<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
</bean>

and then use the properties like:

<bean ...>
   <property name="compassIndex" value="${compass-index}" />
</bean>

or with @Value("${compass-index}")

Leave a Comment