是的,您可使用<代码>ServletContextParatiesFactoryBean,以揭露context-param
。 价值(也要求完整填写<代码>) PropertyPlaceholderConfigurer ,而不是简单的context:property-placeholder
:
<bean id = "myLocation" class =
"org.springframework.web.context.support.ServletContextParameterFactoryBean">
<property name="initParamName" value = "myParameter" />
</bean>
<bean class =
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" ref = "myLocation" />
</bean>
Or use Spring 3.0 sEL:
<bean class =
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value = "#{contextParameters.myParameter}" />
</bean>