fixed BeanPostProcessor invocation for null bean (SPR-6700)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -103,6 +103,18 @@ public class CommonAnnotationBeanPostProcessorTests {
|
||||
assertTrue(bean.destroyCalled);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPostProcessorWithNullBean() {
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
|
||||
bf.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor());
|
||||
RootBeanDefinition rbd = new RootBeanDefinition(NullFactory.class);
|
||||
rbd.setFactoryMethodName("create");
|
||||
bf.registerBeanDefinition("bean", rbd);
|
||||
|
||||
assertNull(bf.getBean("bean"));
|
||||
bf.destroySingletons();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerialization() throws Exception {
|
||||
CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
|
||||
@@ -578,4 +590,12 @@ public class CommonAnnotationBeanPostProcessorTests {
|
||||
private INestedTestBean testBean;
|
||||
}
|
||||
|
||||
|
||||
private static class NullFactory {
|
||||
|
||||
public static Object create() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user