@@ -689,33 +689,35 @@ public Class<?> getType(String name, boolean allowFactoryBeanInit) throws NoSuch
689
689
}
690
690
691
691
RootBeanDefinition mbd = getMergedLocalBeanDefinition (beanName );
692
-
693
- // Check decorated bean definition, if any: We assume it'll be easier
694
- // to determine the decorated bean's type than the proxy's type.
695
- BeanDefinitionHolder dbd = mbd .getDecoratedDefinition ();
696
- if (dbd != null && !BeanFactoryUtils .isFactoryDereference (name )) {
697
- RootBeanDefinition tbd = getMergedBeanDefinition (dbd .getBeanName (), dbd .getBeanDefinition (), mbd );
698
- Class <?> targetClass = predictBeanType (dbd .getBeanName (), tbd );
699
- if (targetClass != null && !FactoryBean .class .isAssignableFrom (targetClass )) {
700
- return targetClass ;
701
- }
702
- }
703
-
704
692
Class <?> beanClass = predictBeanType (beanName , mbd );
705
693
706
- // Check bean class whether we're dealing with a FactoryBean.
707
- if (beanClass != null && FactoryBean .class .isAssignableFrom (beanClass )) {
708
- if (!BeanFactoryUtils .isFactoryDereference (name )) {
709
- // If it's a FactoryBean, we want to look at what it creates, not at the factory class.
710
- return getTypeForFactoryBean (beanName , mbd , allowFactoryBeanInit ).resolve ();
694
+ if (beanClass != null ) {
695
+ // Check bean class whether we're dealing with a FactoryBean.
696
+ if (FactoryBean .class .isAssignableFrom (beanClass )) {
697
+ if (!BeanFactoryUtils .isFactoryDereference (name )) {
698
+ // If it's a FactoryBean, we want to look at what it creates, not at the factory class.
699
+ beanClass = getTypeForFactoryBean (beanName , mbd , allowFactoryBeanInit ).resolve ();
700
+ }
711
701
}
712
- else {
713
- return beanClass ;
702
+ else if ( BeanFactoryUtils . isFactoryDereference ( name )) {
703
+ return null ;
714
704
}
715
705
}
716
- else {
717
- return (!BeanFactoryUtils .isFactoryDereference (name ) ? beanClass : null );
706
+
707
+ if (beanClass == null ) {
708
+ // Check decorated bean definition, if any: We assume it'll be easier
709
+ // to determine the decorated bean's type than the proxy's type.
710
+ BeanDefinitionHolder dbd = mbd .getDecoratedDefinition ();
711
+ if (dbd != null && !BeanFactoryUtils .isFactoryDereference (name )) {
712
+ RootBeanDefinition tbd = getMergedBeanDefinition (dbd .getBeanName (), dbd .getBeanDefinition (), mbd );
713
+ Class <?> targetClass = predictBeanType (dbd .getBeanName (), tbd );
714
+ if (targetClass != null && !FactoryBean .class .isAssignableFrom (targetClass )) {
715
+ return targetClass ;
716
+ }
717
+ }
718
718
}
719
+
720
+ return beanClass ;
719
721
}
720
722
721
723
@ Override
0 commit comments