Announcement Announcement Module
Collapse
No announcement yet.
aop:scoped-proxy and Map/List-FactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • aop:scoped-proxy and Map/List-FactoryBean

    hi all,

    i am currently running in a problem when using an injected map which is "aop:scoped".

    here is some code:

    Code:
    	<bean id="mylist" class="org.springframework.beans.factory.config.ListFactoryBean" scope="request">
    		<property name="singleton" value="false"/>
    		<property name="sourceList">
    			<list/>
    		</property>
    		<aop:scoped-proxy/>
    	</bean>
    initialization work fine but the following is the problem:

    Code:
    ApplicationContext ctx = ... // do lookup
    List l = (List)ctx.getBean("mylist");
    l.add("entry");
    but l.size() still returns "0"

    when i remove the "<aop:scoped-proxy/>" element from the bean it work as expected and l.size() returns "1"

    the same behaviour is when i use MapFactoryBean.

    i can see in my debugger that List.add() is invoked but it seams like the any of the aop-proxy creates a new instance instead of returning the existing one.

    this happens in 2.0.2 and 2.0.3

    PS:
    why does <util:map> not support "scoped" ?

    regards
    jan

  • #2
    Not sure, but
    Code:
    <property name="singleton" value="false"/>
    looks suspicious. Can you test it without it?

    Jörg

    Comment

    Working...
    X