Buggy code:
public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFactory implements AutowireCapableBeanFactory { private InstantiationStrategy instantiationStrategy = new CglibSubclassingInstantiationStrategy ( ) ; private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer ( ) ; 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 ) { } @ Override @ SuppressWarnings ( "unchecked" ) public < T > T createBean ( Class < T > beanClass ) throws BeansException { } @ Override public void autowireBean ( Object existingBean ) { } @ Override public Object configureBean ( Object existingBean , String beanName ) throws BeansException { } @ Override public Object resolveDependency ( DependencyDescriptor descriptor , String beanName ) throws BeansException { } @ Override public Object createBean ( Class < ? > beanClass , int autowireMode , boolean dependencyCheck ) throws BeansException { } @ Override public Object autowire ( Class < ? > beanClass , int autowireMode , boolean dependencyCheck ) throws BeansException { } @ Override public void autowireBeanProperties ( Object existingBean , int autowireMode , boolean dependencyCheck ) throws BeansException { } @ Override public void applyBeanPropertyValues ( Object existingBean , String beanName ) throws BeansException { } @ Override public Object initializeBean ( Object existingBean , String beanName ) { } @ Override public Object applyBeanPostProcessorsBeforeInitialization ( Object existingBean , String beanName ) throws BeansException { } @ Override public Object applyBeanPostProcessorsAfterInitialization ( Object existingBean , String beanName ) throws BeansException { } @ Override public void destroyBean ( Object existingBean ) { } @ 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 ) { if ( factoryMethodName != null ) { BeanDefinition fbDef = getBeanDefinition ( factoryBeanName ) ; if ( ( fbDef instanceof AbstractBeanDefinition ) && ( ( ( AbstractBeanDefinition ) ( fbDef ) ) . hasBeanClass ( ) ) ) { Class < ? > fbClass = ClassUtils . getUserClass ( ( ( AbstractBeanDefinition ) ( fbDef ) ) . getBeanClass ( ) ) ; ReflectionUtils . doWithMethods ( fbClass , new ReflectionUtils . MethodCallback ( ) { @ Override 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 ) ; } } } ) ; <START_BUG> if ( ( objectType . value ) != null ) { <END_BUG> return objectType . value ; } } } if ( ! ( isBeanEligibleForMetadataCaching ( factoryBeanName ) ) ) { return null ; } } 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 ) { }

Fix:
if ( ( ( objectType . value ) != null ) && ( ! ( Object . class . equals ( objectType . value ) ) ) ) {