Google News
logo
Java Springs - Interview Questions
What are inner beans in Spring?
A <bean/> element inside the <property/> or <constructor-arg/>  elements defines a so-called inner bean. An inner bean definition does not require a defined id or name; the container ignores these values. It also ignores the scope flag. Inner beans are always anonymous and they are always scoped as prototypes.
<bean id = "outerBean" class = "...">
      <property name = "target">
         <bean id = "innerBean" class = "..."/>
      </property>
</bean>​
Advertisement