實際應用中,某個實例的屬性可能是另一個對象的一個屬性,Spring支持將bean實例的屬性值直接賦值給一個變量
屬性值的注入,是通過PropertyPathFactoryBean完成的,PropertyPathFactoryBean用來獲取目標bean的屬性,獲得的值可以注入到其他bean,也可以定義成新的bean
實體類:
配置文件:提供四種注入
測試代碼:
運行結果:
person age is:16 person age is:16 16 30