Buggy code:
public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFactory implements AutowireCapableBeanFactory { private InstantiationStrategy instantiationStrategy = new CglibSubclassingInstantiationStrategy ( ) ; private ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer ( ) ; private boolean allowCircularReferences = true ; private boolean allowRawInjectionDespiteWrapping = false ; private final Set < Class > ignoredDependencyTypes = new HashSet < Class > ( ) ; private final Set < Class > ignoredDependencyInterfaces = new HashSet < Class > ( ) ; private final Map < String , BeanWrapper > factoryBeanInstanceCache = new ConcurrentHashMap < String , BeanWrapper > ( 16 ) ; private final Map < Class , PropertyDescriptor [ ] > filteredPropertyDescriptorsCache = new ConcurrentHashMap < Class , PropertyDescriptor [ ] > ( 64 ) ; public AbstractAutowireCapableBeanFactory ( ) { } public AbstractAutowireCapableBeanFactory ( BeanFactory parentBeanFactory ) { } public void setInstantiationStrategy ( InstantiationStrategy instantiationStrategy ) { } protected InstantiationStrategy getInstantiationStrategy ( ) { } public void setParameterNameDiscoverer ( ParameterNameDiscoverer parameterNameDiscoverer ) { } protected ParameterNameDiscoverer getParameterNameDiscoverer ( ) { } public void setAllowCircularReferences ( boolean allowCircularReferences ) { } public void setAllowRawInjectionDespiteWrapping ( boolean allowRawInjectionDespiteWrapping ) { } public void ignoreDependencyType ( Class type ) { } public void ignoreDependencyInterface ( Class ifc ) { } @ Override public void copyConfigurationFrom ( ConfigurableBeanFactory otherFactory ) { } @ SuppressWarnings ( "unchecked" ) public < T > T createBean ( Class < T > beanClass ) throws BeansException { } public void autowireBean ( Object existingBean ) { } public Object configureBean ( Object existingBean , String beanName ) throws BeansException { } public Object resolveDependency ( DependencyDescriptor descriptor , String beanName ) throws BeansException { } public Object createBean ( Class beanClass , int autowireMode , boolean dependencyCheck ) throws BeansException { } public Object autowire ( Class beanClass , int autowireMode , boolean dependencyCheck ) throws BeansException { } public void autowireBeanProperties ( Object existingBean , int autowireMode , boolean dependencyCheck ) throws BeansException { } public void applyBeanPropertyValues ( Object existingBean , String beanName ) throws BeansException { } public Object initializeBean ( Object existingBean , String beanName ) { } public Object applyBeanPostProcessorsBeforeInitialization ( Object existingBean , String beanName ) throws BeansException { } public Object applyBeanPostProcessorsAfterInitialization ( Object existingBean , String beanName ) throws BeansException { } @ Override protected Object createBean ( final String beanName , final RootBeanDefinition mbd , final Object [ ] args ) throws BeanCreationException { } protected Object doCreateBean ( final String beanName , final RootBeanDefinition mbd , final Object [ ] args ) { } @ Override protected Class predictBeanType ( String beanName , RootBeanDefinition mbd , Class ... typesToMatch ) { } protected Class getTypeForFactoryMethod ( String beanName , RootBeanDefinition mbd , Class [ ] typesToMatch ) { } @ Override protected Class < ? > getTypeForFactoryBean ( String beanName , RootBeanDefinition mbd ) { class Holder { Class < ? > value = null ; } final Holder objectType = new Holder ( ) ; String factoryBeanName = mbd . getFactoryBeanName ( ) ; final String factoryMethodName = mbd . getFactoryMethodName ( ) ; if ( ( factoryBeanName != null ) && ( factoryMethodName != null ) ) { BeanDefinition fbDef = getBeanDefinition ( factoryBeanName ) ; <START_BUG> if ( fbDef instanceof AbstractBeanDefinition ) { <END_BUG> Class < ? > fbClass = ( ( AbstractBeanDefinition ) ( fbDef ) ) . getBeanClass ( ) ; if ( ClassUtils . isCglibProxyClass ( fbClass ) ) { fbClass = fbClass . getSuperclass ( ) ; } ReflectionUtils . doWithMethods ( fbClass , new ReflectionUtils . MethodCallback ( ) { public void doWith ( Method method ) throws IllegalAccessException , IllegalArgumentException { if ( ( method . getName ( ) . equals ( factoryMethodName ) ) && ( FactoryBean . class . isAssignableFrom ( method . getReturnType ( ) ) ) ) { objectType . value = GenericTypeResolver . resolveReturnTypeArgument ( method , FactoryBean . class ) ; } } } ) ; if ( ( objectType . value ) != null ) { return objectType . value ; } } } FactoryBean < ? > fb = ( mbd . isSingleton ( ) ) ? getSingletonFactoryBeanForTypeCheck ( beanName , mbd ) : getNonSingletonFactoryBeanForTypeCheck ( beanName , mbd ) ; if ( fb != null ) { objectType . value = getTypeForFactoryBean ( fb ) ; if ( ( objectType . value ) != null ) { return objectType . value ; } } return super . getTypeForFactoryBean ( beanName , mbd ) ; } protected Object getEarlyBeanReference ( String beanName , RootBeanDefinition mbd , Object bean ) { } private FactoryBean getSingletonFactoryBeanForTypeCheck ( String beanName , RootBeanDefinition mbd ) { } private FactoryBean getNonSingletonFactoryBeanForTypeCheck ( String beanName , RootBeanDefinition mbd ) { } protected void applyMergedBeanDefinitionPostProcessors ( RootBeanDefinition mbd , Class beanType , String beanName ) throws BeansException { } protected Object resolveBeforeInstantiation ( String beanName , RootBeanDefinition mbd ) { } protected Object applyBeanPostProcessorsBeforeInstantiation ( Class beanClass , String beanName ) throws BeansException { } protected BeanWrapper createBeanInstance ( String beanName , RootBeanDefinition mbd , Object [ ] args ) { } protected Constructor [ ] determineConstructorsFromBeanPostProcessors ( Class beanClass , String beanName ) throws BeansException { } protected BeanWrapper instantiateBean ( final String beanName , final RootBeanDefinition mbd ) { } protected BeanWrapper instantiateUsingFactoryMethod ( String beanName , RootBeanDefinition mbd , Object [ ] explicitArgs ) { } protected BeanWrapper autowireConstructor ( String beanName , RootBeanDefinition mbd , Constructor [ ] ctors , Object [ ] explicitArgs ) { } protected void populateBean ( String beanName , RootBeanDefinition mbd , BeanWrapper bw ) { } protected void autowireByName ( String beanName , AbstractBeanDefinition mbd , BeanWrapper bw , MutablePropertyValues pvs ) { } protected void autowireByType ( String beanName , AbstractBeanDefinition mbd , BeanWrapper bw , MutablePropertyValues pvs ) { } protected String [ ] unsatisfiedNonSimpleProperties ( AbstractBeanDefinition mbd , BeanWrapper bw ) { } protected PropertyDescriptor [ ] filterPropertyDescriptorsForDependencyCheck ( BeanWrapper bw , boolean cache ) { }

Fix:
if ( ( fbDef instanceof AbstractBeanDefinition ) && ( ( ( AbstractBeanDefinition ) ( fbDef ) ) . hasBeanClass ( ) ) ) {