Buggy code:
public class CommonAnnotationBeanPostProcessorTests { @ Test public void testPostConstructAndPreDestroy ( ) { } @ Test public void testPostConstructAndPreDestroyWithPostProcessor ( ) { } @ Test public void testPostConstructAndPreDestroyWithApplicationContextAndPostProcessor ( ) { } @ Test public void testPostConstructAndPreDestroyWithManualConfiguration ( ) { } @ Test public void testPostProcessorWithNullBean ( ) { } @ Test public void testSerialization ( ) throws Exception { } @ Test public void testSerializationWithManualConfiguration ( ) throws Exception { } @ Test public void testResourceInjection ( ) { } @ Test public void testResourceInjectionWithTwoProcessors ( ) { } @ Test public void testResourceInjectionFromJndi ( ) { } @ Test public void testExtendedResourceInjection ( ) { DefaultListableBeanFactory bf = new DefaultListableBeanFactory ( ) ; CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor ( ) ; bpp . setBeanFactory ( bf ) ; bf . addBeanPostProcessor ( bpp ) ; bf . registerResolvableDependency ( BeanFactory . class , bf ) ; PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer ( ) ; Properties props = new Properties ( ) ; props . setProperty ( "tb" , "testBean3" ) ; ppc . setProperties ( props ) ; ppc . postProcessBeanFactory ( bf ) ; bf . registerBeanDefinition ( "annotatedBean" , new RootBeanDefinition ( CommonAnnotationBeanPostProcessorTests . ExtendedResourceInjectionBean . class ) ) ; bf . registerBeanDefinition ( "annotatedBean2" , new RootBeanDefinition ( CommonAnnotationBeanPostProcessorTests . NamedResourceInjectionBean . class ) ) ; bf . registerBeanDefinition ( "annotatedBean3" , new RootBeanDefinition ( CommonAnnotationBeanPostProcessorTests . ConvertedResourceInjectionBean . class ) ) ; TestBean tb = new TestBean ( ) ; bf . registerSingleton ( "testBean" , tb ) ; TestBean tb2 = new TestBean ( ) ; bf . registerSingleton ( "testBean2" , tb2 ) ; TestBean tb3 = new TestBean ( ) ; bf . registerSingleton ( "testBean3" , tb3 ) ; TestBean tb4 = new TestBean ( ) ; bf . registerSingleton ( "testBean4" , tb4 ) ; NestedTestBean tb6 = new NestedTestBean ( ) ; <START_BUG> bf . registerSingleton ( "value" , new Object ( ) ) ; <END_BUG> bf . registerSingleton ( "xy" , tb6 ) ; bf . registerAlias ( "xy" , "testBean9" ) ; CommonAnnotationBeanPostProcessorTests . ExtendedResourceInjectionBean bean = ( ( CommonAnnotationBeanPostProcessorTests . ExtendedResourceInjectionBean ) ( bf . getBean ( "annotatedBean" ) ) ) ; assertTrue ( bean . initCalled ) ; assertTrue ( bean . init2Called ) ; assertSame ( tb , bean . getTestBean ( ) ) ; assertSame ( tb2 , bean . getTestBean2 ( ) ) ; assertSame ( tb4 , bean . getTestBean3 ( ) ) ; assertSame ( tb3 , bean . getTestBean4 ( ) ) ; assertSame ( tb6 , bean . testBean5 ) ; assertSame ( tb6 , bean . testBean6 ) ; assertSame ( bf , bean . beanFactory ) ; CommonAnnotationBeanPostProcessorTests . NamedResourceInjectionBean bean2 = ( ( CommonAnnotationBeanPostProcessorTests . NamedResourceInjectionBean ) ( bf . getBean ( "annotatedBean2" ) ) ) ; assertSame ( tb6 , bean2 . testBean ) ; CommonAnnotationBeanPostProcessorTests . ConvertedResourceInjectionBean bean3 = ( ( CommonAnnotationBeanPostProcessorTests . ConvertedResourceInjectionBean ) ( bf . getBean ( "annotatedBean3" ) ) ) ; assertSame ( 5 , bean3 . value ) ; bf . destroySingletons ( ) ; assertTrue ( bean . destroyCalled ) ; assertTrue ( bean . destroy2Called ) ; } @ Test public void testExtendedResourceInjectionWithOverriding ( ) { } @ Test public void testExtendedEjbInjection ( ) { } public static class AnnotatedInitDestroyBean { public boolean initCalled = false ; public boolean destroyCalled = false ; @ PostConstruct private void init ( ) { } @ PreDestroy private void destroy ( ) { } } public static class InitDestroyBeanPostProcessor implements DestructionAwareBeanPostProcessor { public Object postProcessBeforeInitialization ( Object bean , String beanName ) throws BeansException { } public Object postProcessAfterInitialization ( Object bean , String beanName ) throws BeansException { } public void postProcessBeforeDestruction ( Object bean , String beanName ) throws BeansException { } } public static class ResourceInjectionBean extends CommonAnnotationBeanPostProcessorTests . AnnotatedInitDestroyBean { public boolean init2Called = false ; public boolean init3Called = false ; public boolean destroy2Called = false ; public boolean destroy3Called = false ; @ Resource private TestBean testBean ; private TestBean testBean2 ; @ PostConstruct protected void init2 ( ) { } @ PostConstruct private void init ( ) { } @ PreDestroy protected void destroy2 ( ) { } @ PreDestroy private void destroy ( ) { } @ Resource public void setTestBean2 ( TestBean testBean2 ) { } public TestBean getTestBean ( ) { } public TestBean getTestBean2 ( ) { } } public static class ExtendedResourceInjectionBean extends CommonAnnotationBeanPostProcessorTests . ResourceInjectionBean { @ Resource ( name = "testBean4" , type = TestBean . class ) protected ITestBean testBean3 ; private ITestBean testBean4 ; @ Resource private INestedTestBean testBean5 ; private INestedTestBean testBean6 ; @ Resource private BeanFactory beanFactory ; @ Resource public void setTestBean2 ( TestBean testBean2 ) { } @ Resource ( name = "${tb}" , type = ITestBean . class ) private void setTestBean4 ( ITestBean testBean4 ) { } @ Resource public void setTestBean6 ( INestedTestBean testBean6 ) { } public ITestBean getTestBean3 ( ) { } public ITestBean getTestBean4 ( ) { } @ PostConstruct protected void init2 ( ) { } @ PreDestroy protected void destroy2 ( ) { } } public static class ExtendedEjbInjectionBean extends CommonAnnotationBeanPostProcessorTests . ResourceInjectionBean { @ EJB ( name = "testBean4" , beanInterface = TestBean . class ) protected ITestBean testBean3 ; private ITestBean testBean4 ; @ EJB private INestedTestBean testBean5 ; private INestedTestBean testBean6 ; @ Resource private BeanFactory beanFactory ; @ EJB public void setTestBean2 ( TestBean testBean2 ) { } @ EJB ( beanName = "testBean3" , beanInterface = ITestBean . class ) private void setTestBean4 ( ITestBean testBean4 ) { } @ EJB public void setTestBean6 ( INestedTestBean testBean6 ) { } public ITestBean getTestBean3 ( ) { } public ITestBean getTestBean4 ( ) { } @ PostConstruct protected void init2 ( ) { } @ PreDestroy protected void destroy2 ( ) { } }

Fix:
bf . registerSingleton ( "value" , "5" ) ;