-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Moritz Siuts opened SPR-6774 and commented
I have a bean called "mybean" and an alias of this bean configured like <alias name="mybean" alias="aliasofmybean" />.
Because I want an Interceptor applied to this bean I configure a BeanNameAutoProxyCreator like this:
<bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="interceptorNames">
<list>
<idref local="myInterceptor" />
</list>
</property>
<property name="beanNames">
<list>
<value>aliasofmybean</value> <!-- or idref, does not matter -->
</list>
</property>
</bean>
Of course there is a "myInterceptor" bean defined properly.
Whenever I get the "aliasofmybean" or "mybean" I won't get the proxy - the BeanNameAutoProxyCreator does not work in this case.
I have to use "mybean" as an Element of BeanNameAutoProxyCreator.beanNames to make it work.
This is not mentioned in the documentation (neither for the BeanNameAutoProxyCreator nor for the <alias>), so I did not expect this behaviour. I think the issue is the same in Spring 3.0, but I only tested it with Spring 2.5.6.
The above example with the alias isn't quite usefull, but we have a lot of components and some generated wiring so that we have a real use case for the <alias> tags.
Affects: 2.5.6
Referenced from: commits 6070a49