inner bean - aop proxy

Posted on 2011-05-04
Last Modified: 2012-05-11
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"
<property name="studentService">
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.
Question by:gudii9
    LVL 92

    Accepted Solution

    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=""/>
    <bean id="courseService" class="">
       <property name="studentService" ref="students">
    you can use:
    <bean id="courseService" class="">
       <property name="studentService">
           <bean class=""/>

    Open in new window

    LVL 7

    Author Comment

    can you please elaborate on this.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    scores100 challenge 3 67
    wordsWithout 49 64
    mergeTwo  challenge 13 53
    array6 challenfge 6 48
    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now