【发布时间】:2011-08-05 15:16:57
【问题描述】:
我想根据属性文件的请求获取特定的值。如何做到这一点?
我有以下 spring 配置。我想根据请求设置 Exprops 的值并从属性文件中获取相应的值
<bean id="Prop" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:ErrorMessage.properties</value>
</property>
</bean>
<bean id="PropertiesBean" class="com.util.PropertiesUtil">
<property name="Exprops" value="${EXampleExceptiion}"></property>
</bean>
【问题讨论】:
-
PropertyPlaceholderConfigurer 仅用于配置您的应用程序,它是静态的,不打算由您的应用程序调用。
-
我猜你必须自己实现这个。据我所知,Spring 对此没有具体的支持。
-
感谢@Ralph,@Benjamin..任何人都可以为我提供从 PropertyPlaceholderConfigurer 读取的文件可用于在运行时设置值的实现
标签: spring properties