【发布时间】:2010-11-20 21:41:02
【问题描述】:
是否可以在 spring 上下文文件中定义一个或多个属性
可以在
下面的例子最能说明我需要什么——我想定义属性 FOO 一次,然后在我的各种
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<properties>
<property name="FOO" value="BAR">
</properties>
<bean name="TEST" class="mytest">
<property name="MYFOO" value="${FOO}"/>
</bean>
<bean name="TEST1" class="mytest1">
<property name="MYFOO" value="${FOO}"/>
</bean>
</beans>
任何意见将不胜感激。
谢谢,凯文。
【问题讨论】:
标签: spring