我需要bean
这样的
<bean id="studentWithSchool" class="com.model.Student" scope="prototype">
<property name="school">
<bean class="com.model.School" scope="prototype"/>
</property>
</bean>
还行吧。
我的问题是我让学生从不同 bean 的方法返回。
当是一个属性时,我通常像这样加载bean。
<property name='beanProperty' value='#{anotherBean.getBeanProperty()}'/>
但在这种情况下,我需要从另一个 bean 方法设置新 bean 本身(School object is returned from another bean method)
。
这是我尝试的,当然这是错误的:
<bean id="studentWithSchool" class="com.model.Student" scope="prototype" value='#{anotherBean.getBeanProperty()}'>
<property name="school">
<bean class="com.model.School" scope="prototype"/>
</property>
</bean>
有什么解决方法吗?