Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6779201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:21:25+00:00 2026-05-26T16:21:25+00:00

This is from Spring documentation , section 9.5.4 <bean id=myAdvisor class=com.mycompany.MyAdvisor> <property name=someProperty value=Custom

  • 0

This is from Spring documentation, section 9.5.4

<bean id="myAdvisor" class="com.mycompany.MyAdvisor">
    <property name="someProperty" value="Custom string property value"/>
</bean>

<bean id="debugInterceptor"class="org.springframework.aop.interceptor.DebugInterceptor">
</bean>

<bean id="person" 
    class="org.springframework.aop.framework.ProxyFactoryBean">
    <property name="proxyInterfaces" value="com.mycompany.Person"/>

    <property name="target" ref="personTarget"/>
    <property name="interceptorNames">
        <list>
            <value>myAdvisor</value>
            <value>debugInterceptor</value>
        </list>
    </property>
</bean>

Now, the note below the code says:

You might be wondering why the list
doesn’t hold bean references. The reason for this is that if the
ProxyFactoryBean’s singleton property is set to false, it must be able
to return independent proxy instances. If any of the advisors is
itself a prototype, an independent instance would need to be returned,
so it’s necessary to be able to obtain an instance of the prototype
from the factory; holding a reference isn’t sufficient.

Could someone please explain how this works. I know the various scopes. So I know that a new instance needs to be returned if advisors are prototype. But I did not get the last statement (highlighted in bold). If I specify ref="debugInterceptor" will the bean creation mechanism change? Does it mean that if I ref a bean, it will be a singleton instance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:21:26+00:00Added an answer on May 26, 2026 at 4:21 pm

    Does it mean that if I ref a bean, it will be a singleton instance.

    No, but the bean being referred to will be instantiated when the referring bean is instantiated. If Bean A (singleton scope) has a ref to Bean B (prototype scope), then Bean B will be created and injected into Bean A just the once. As far as Bean A is concerned, Bean B is a singleton.

    The ProxyFactoryBean must hold a list of bean names so that it doesn’t force the dereferencing of the interceptors when the ProxyFactoryBean itself is created. By holding a list of names, it can defer the lookup of the interceptors until the last minute, allowing the interceptors to be prototype scoped beans.

    Does that help?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So from this string: name[id] I need this: id I used str.split ('[]'), but
This works: from x in table.AsEnumerable() where x.Field<string>(something) == value select x.Field<decimal>(decimalfield); but, this
I have this method for grabbing the file name from a string URI. What
I have a spring controller defined like this: @Controller @RequestMapping(/user) class UserController { ...
I learned today through this section of the MySQL documentation that prepared statements cannot
Following various example configurations from Spring documentation as well as some forums on the
I am considering to utilize Expression-Based Access Control from Spring Security 3.0. The documentation
So I've been following the Spring documentation, specifically this part, http://static.springsource.org/spring/docs/current/spring-framework-reference/html/beans.html#beans-factory-collaborators on Dependency Injection,
I wondering is there an equivalent of this feature from play framework http://www.playframework.org/documentation/2.0/JavaAsync Basicly
How do I go from this string: ThisIsMyCapsDelimitedString ...to this string: This Is My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.