diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java index f796bee950..72b243aa81 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java @@ -590,10 +590,6 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac } } } - if (FactoryBean.class.equals(beanClass) && mbd.isSingleton() && - (typesToMatch.length > 1 || (typesToMatch.length == 1 && !typesToMatch[0].equals(FactoryBean.class)))) { - return getSingletonFactoryBeanForTypeCheck(beanName, mbd).getClass(); - } return beanClass; } diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java index e5f00787ab..9e2508ea78 100644 --- a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java @@ -917,7 +917,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader } // Initialize LoadTimeWeaverAware beans early to allow for registering their transformers early. - String[] weaverAwareNames = beanFactory.getBeanNamesForType(LoadTimeWeaverAware.class, false, true); + String[] weaverAwareNames = beanFactory.getBeanNamesForType(LoadTimeWeaverAware.class, false, false); for (String weaverAwareName : weaverAwareNames) { getBean(weaverAwareName); } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java index 44b79e6d0e..11004182c8 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java @@ -145,8 +145,8 @@ public class ConfigurationClassProcessingTests { assertTrue(factory.isTypeMatch("factoryBean", List.class)); assertEquals(FactoryBean.class, factory.getType("&factoryBean")); assertTrue(factory.isTypeMatch("&factoryBean", FactoryBean.class)); - assertTrue(factory.isTypeMatch("&factoryBean", BeanClassLoaderAware.class)); - assertTrue(factory.isTypeMatch("&factoryBean", ListFactoryBean.class)); + assertFalse(factory.isTypeMatch("&factoryBean", BeanClassLoaderAware.class)); + assertFalse(factory.isTypeMatch("&factoryBean", ListFactoryBean.class)); assertTrue(factory.getBean("factoryBean") instanceof List); String[] beanNames = factory.getBeanNamesForType(FactoryBean.class);