Skip to content

Commit

Permalink
Reproduce SPR-8639 failure in anticipation of fix
Browse files Browse the repository at this point in the history
This change re-introduces ProxyFactoryBean usage to demonstrate the
issue described in the previous commit.  Notice that debug logging is
enabled.  The following log statement documents 'ignoring' (suppressing)
the underlying exception.

To fix this issue, we'll see about allowing this exception to propagate
when dealing with ProxyFactoryBeans that do not have a fixed object type
that can be determined by static generics analysis or a call to
getObjectType on an early FactoryBean reference.

DEBUG: org.springframework.beans.factory.support.DefaultListableBeanFactory
- Ignoring bean creation exception on FactoryBean type check:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'b' defined in class path resource
[org/springframework/issues/ReproTests-context.xml]: Cannot create inner
bean 'org.springframework.issues.B#7e9ffe3f' of type
[org.springframework.issues.B] while setting bean property 'target';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.issues.B#7e9ffe3f'
defined in class path resource
[org/springframework/issues/ReproTests-context.xml]: Cannot resolve
reference to bean 'c' while setting bean property 'c'; nested exception
is org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'c':
org.springframework.beans.factory.FactoryBeanNotInitializedException:
Cannot determine target class for proxy

Issue: SPR-8639
  • Loading branch information
cbeams committed Sep 13, 2011
1 parent e2f5175 commit 03d978f
Showing 1 changed file with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,32 @@

<context:annotation-config/>

<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="interceptorNames" value="myInterceptor"/>
<property name="beanNames" value="a,b,c"/>
</bean>

<bean id="myInterceptor" class="org.springframework.issues.MyInterceptor"/>

<bean id="a" class="org.springframework.issues.A">
<property name="c" ref="c"/>
<bean id="a" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="org.springframework.issues.A">
<property name="c" ref="c"/>
</bean>
</property>
<property name="interceptorNames" value="myInterceptor"/>
</bean>

<bean id="b" class="org.springframework.issues.B">
<property name="c" ref="c"/>
<bean id="b" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="org.springframework.issues.B">
<property name="c" ref="c"/>
</bean>
</property>
<property name="interceptorNames" value="myInterceptor"/>
</bean>

<bean id="c" class="org.springframework.issues.C"/>
<bean id="c" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="org.springframework.issues.C"/>
</property>
<property name="interceptorNames" value="myInterceptor"/>
</bean>

<!-- will be @Autowired into C -->
<bean id="d" class="org.springframework.issues.D"/>
Expand Down

0 comments on commit 03d978f

Please sign in to comment.