例如对于以下的例子
<bean id="person" class="com.alibaba.chj.factorybean.Person" scope="prototype">
<property name="age">
<value>30</value>
</property>
<property name="son">
<bean class="com.alibaba.chj.factorybean.Son">
<property name="age">
<value>16</value>
</property>
</bean>
</property>
</bean>
<bean id="son2" class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
<property name="targetBeanName">
<value>person</value>
</property>
<property name="propertyPath">
<value>son</value>
</property>
</bean>
这里son2配置中用了PropertyPathFactoryBean,son2这是什么?单纯的一个bean,有个属性其值为person.getAge(),但是这个bean仅仅就是只有获取person.getAge()的值?我看不出这样的配置有什么存在的必要,求指点
使用<bean>元素,实际上是让Spring执行无参或有参构造器
使用<property>元素,实际上是让Spring执行一次setter方法
调用getter方法:使用PropertyPathFactoryBean
age属性不是直接注入,而是将person中的son的age属性赋值给son2的age属性