引用Bean的属性值
从Spring3.0开始,可以通过#{beanName.beanProp}的方式方便地引用另一个bean的属性值
1、不需要使用PropertyPlaceholderConfigurer。
2、这里是井号
demo
1、xml配置实现
package test; import org.springframework.beans.factory.annotation.Value; public class User { private String name; @Value("#{initUser.age}") private int age; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }