<?xml version="1.0" encoding="UTF-8"?> <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-3.0.xsd"> <!-- Definition for textEditor bean using inner bean -->
<bean id="..." class="...">
<property name="spellChecker">
<bean id="随意..." class="..."/>
</property>
</bean> </beans>
注意,属性的name值要和方法内的属性一致,并且要注入的属性要有set方法,其实这个就是set方法注入,只不过把bean直接写在须要注入的属性标签里面