ReferenceAnnotationBeanPostProcessor extends AnnotationInjectedBeanPostProcessor<Reference> implements ApplicationContextAware, ApplicationListener { public Collection<ReferenceBean<?>> getReferenceBeans() { return referenceBeanCache.values(); }  Collection<ReferenceBean<?>> getReferenceBeans(); Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> getInjectedFieldReferenceBeanMap(); Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> getInjectedMethodReferenceBeanMap(); @Override void setApplicationContext(ApplicationContext applicationContext); @Override void onApplicationEvent(ApplicationEvent event); @Override void destroy(); static final String BEAN_NAME; }
@Test public void testGetReferenceBeans() { ReferenceAnnotationBeanPostProcessor beanPostProcessor = context.getBean(BEAN_NAME, ReferenceAnnotationBeanPostProcessor.class); Collection<ReferenceBean<?>> referenceBeans = beanPostProcessor.getReferenceBeans(); Assert.assertEquals(1, referenceBeans.size()); ReferenceBean<?> referenceBean = referenceBeans.iterator().next(); TestBean testBean = context.getBean(TestBean.class); Assert.assertNotNull(referenceBean.get()); }