fixed decorated BeanDefinition condition for early type checking in AbstractBeanFactory (SPR-7006)
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
||||
http://www.springframework.org/schema/beans/test http://www.springframework.org/schema/beans/factory/xml/support/CustomNamespaceHandlerTests.xsd">
|
||||
http://www.springframework.org/schema/beans/test http://www.springframework.org/schema/beans/factory/xml/support/CustomNamespaceHandlerTests.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<test:testBean id="testBean" name="Rob Harrop" age="23"/>
|
||||
|
||||
@@ -19,7 +20,7 @@
|
||||
<property name="age" value="23"/>
|
||||
</bean>
|
||||
|
||||
<bean id="debuggingTestBeanNoInstance" class="org.springframework.beans.ITestBean">
|
||||
<bean id="debuggingTestBeanNoInstance" class="org.springframework.context.ApplicationListener">
|
||||
<test:debug/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.beans.factory.xml.PluggableSchemaResolver;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
@@ -77,17 +79,18 @@ public class CustomNamespaceHandlerTests {
|
||||
private static final String NS_XML = format("%s/%s-context.xml", FQ_PATH, CLASSNAME);
|
||||
private static final String TEST_XSD = format("%s/%s.xsd", FQ_PATH, CLASSNAME);
|
||||
|
||||
private DefaultListableBeanFactory beanFactory;
|
||||
private GenericApplicationContext beanFactory;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS);
|
||||
this.beanFactory = new DefaultListableBeanFactory();
|
||||
this.beanFactory = new GenericApplicationContext();
|
||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
|
||||
reader.setNamespaceHandlerResolver(resolver);
|
||||
reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
|
||||
reader.setEntityResolver(new DummySchemaResolver());
|
||||
reader.loadBeanDefinitions(getResource());
|
||||
this.beanFactory.refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +118,7 @@ public class CustomNamespaceHandlerTests {
|
||||
|
||||
@Test
|
||||
public void testProxyingDecoratorNoInstance() throws Exception {
|
||||
String[] beanNames = this.beanFactory.getBeanNamesForType(ITestBean.class);
|
||||
String[] beanNames = this.beanFactory.getBeanNamesForType(ApplicationListener.class);
|
||||
assertTrue(Arrays.asList(beanNames).contains("debuggingTestBeanNoInstance"));
|
||||
try {
|
||||
this.beanFactory.getBean("debuggingTestBeanNoInstance");
|
||||
|
||||
Reference in New Issue
Block a user