inner bean - aop proxy

I was reading folowing line and I did not understand clearly.
Inner beans
Another lesser used means of wiring bean references is to embed a <bean> element
directly in the <property> element. For example, the studentService property
of the courseService bean could be wired as follows:
<bean id="courseService"
class="com.springinaction.service.training.CourseServiceImpl">
<property name="studentService">
<bean
class="com.springinaction.service.training.StudentServiceImpl"/>
</property>
</bean>
The drawback of wiring a bean reference in this manner is that you cannott reuse the
instance of StudentServiceImpl anywhere else it is an instance created specifically
for use by the courseService bean. You may also find that using inner-bean
definitions impacts the readability of the XML. On the other hand, this could be
beneficial if we donot want an actual bean instance to be accessible without a wrapper
bean. For example, if we are creating an AOP proxy, we may not want the target
bean to be accessible in our BeanFactory. In this case, configuring the proxy’s
target using an inner bean would achieve this goal.

Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
LVL 7
gudii9Asked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
Its saying instead of specifying the id/name of a bean for a property, you can include the bean definition itself.

So instead of:

<bean id="students" class="com.springinaction.service.training.StudentServiceImpl"/>
<bean id="courseService" class="com.springinaction.service.training.CourseServiceImpl">
   <property name="studentService" ref="students">
</bean>

you can use:

<bean id="courseService" class="com.springinaction.service.training.CourseServiceImpl">
   <property name="studentService">
       <bean class="com.springinaction.service.training.StudentServiceImpl"/>
   </property>
</bean>

Open in new window

0
 
gudii9Author Commented:
can you please elaborate on this.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.