[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


inner bean - aop proxy

Posted on 2011-05-04
Medium Priority
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

objects earned 2000 total points
ID: 35694879
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">

you can use:

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

Open in new window


Author Comment

ID: 35820157
can you please elaborate on this.

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month19 days, 10 hours left to enroll

873 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