AnnotatedBeanDefinitionRegistryUtils { public static void registerBeans(BeanDefinitionRegistry registry, Class<?>... annotatedClasses) { if (ObjectUtils.isEmpty(annotatedClasses)) { return; } boolean debugEnabled = logger.isDebugEnabled(); AnnotatedBeanDefinitionReader reader = new AnnotatedBeanDefinitionReader(registry); if (debugEnabled) { logger.debug(registry.getClass().getSimpleName() + " will register annotated classes : " + Arrays.asList(annotatedClasses) + " ."); } reader.register(annotatedClasses); }  static void registerBeans(BeanDefinitionRegistry registry, Class<?>... annotatedClasses);  }
@Test public void testRegisterBeans() { AnnotatedBeanDefinitionRegistryUtils.registerBeans(registry, this.getClass()); String[] beanNames = registry.getBeanNamesForType(this.getClass()); Assert.assertEquals(1, beanNames.length); beanNames = registry.getBeanNamesForType(AnnotatedBeanDefinitionRegistryUtils.class); Assert.assertTrue(ObjectUtils.isEmpty(beanNames)); AnnotatedBeanDefinitionRegistryUtils.registerBeans(registry); }