test_class.declarator: springExtensionFactory = new SpringExtensionFactory()
test_class.modifier: private
test_class.original_string: private SpringExtensionFactory springExtensionFactory = new SpringExtensionFactory();
test_class.type: SpringExtensionFactory
test_class.var_name: springExtensionFactory
test_class.declarator: context1
test_class.modifier: private
test_class.original_string: private AnnotationConfigApplicationContext context1;
test_class.type: AnnotationConfigApplicationContext
test_class.var_name: context1
test_class.declarator: context2
test_class.modifier: private
test_class.original_string: private AnnotationConfigApplicationContext context2;
test_class.type: AnnotationConfigApplicationContext
test_class.var_name: context2
test_class.file: dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/extension/SpringExtensionFactoryTest.java
test_class.identifier: SpringExtensionFactoryTest
test_case.body: @Test
      public void testGetExtensionByName() {
          DemoService bean = springExtensionFactory.getExtension(DemoService.class, "bean1");
          Assertions.assertNotNull(bean);
          HelloService hello = springExtensionFactory.getExtension(HelloService.class, "hello");
          Assertions.assertNotNull(hello);
      }
test_case.class_method_signature: SpringExtensionFactoryTest.testGetExtensionByName()
test_case.full_signature: @Test public void testGetExtensionByName()
test_case.identifier: testGetExtensionByName
test_case.invocations: getExtension assertNotNull getExtension assertNotNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetExtensionByName()
focal_class.declarator: logger = LoggerFactory.getLogger(SpringExtensionFactory.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(SpringExtensionFactory.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: CONTEXTS = new ConcurrentHashSet<ApplicationContext>()
focal_class.modifier: private static final
focal_class.original_string: private static final Set<ApplicationContext> CONTEXTS = new ConcurrentHashSet<ApplicationContext>();
focal_class.type: Set<ApplicationContext>
focal_class.var_name: CONTEXTS
focal_class.file: dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/extension/SpringExtensionFactory.java
focal_class.identifier: SpringExtensionFactory
focal_class.interfaces: implements ExtensionFactory
focal_class.class_method_signature: SpringExtensionFactory.addApplicationContext(ApplicationContext context)
focal_class.full_signature: public static void addApplicationContext(ApplicationContext context)
focal_class.identifier: addApplicationContext
focal_class.modifiers: public static
focal_class.parameters: (ApplicationContext context)
focal_class.return: void
focal_class.signature: void addApplicationContext(ApplicationContext context)
focal_class.class_method_signature: SpringExtensionFactory.removeApplicationContext(ApplicationContext context)
focal_class.full_signature: public static void removeApplicationContext(ApplicationContext context)
focal_class.identifier: removeApplicationContext
focal_class.modifiers: public static
focal_class.parameters: (ApplicationContext context)
focal_class.return: void
focal_class.signature: void removeApplicationContext(ApplicationContext context)
focal_class.class_method_signature: SpringExtensionFactory.getContexts()
focal_class.full_signature: public static Set<ApplicationContext> getContexts()
focal_class.identifier: getContexts
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Set<ApplicationContext>
focal_class.signature: Set<ApplicationContext> getContexts()
focal_class.class_method_signature: SpringExtensionFactory.clearContexts()
focal_class.full_signature: public static void clearContexts()
focal_class.identifier: clearContexts
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clearContexts()
focal_class.class_method_signature: SpringExtensionFactory.getExtension(Class<T> type, String name)
focal_class.full_signature: @Override @SuppressWarnings("unchecked") public T getExtension(Class<T> type, String name)
focal_class.identifier: getExtension
focal_class.modifiers: @Override @SuppressWarnings("unchecked") public
focal_class.parameters: (Class<T> type, String name)
focal_class.return: T
focal_class.signature: T getExtension(Class<T> type, String name)
focal_method.body: @Override
      @SuppressWarnings("unchecked")
      public <T> T getExtension(Class<T> type, String name) {
  
          //SPI should be get from SpiExtensionFactory
          if (type.isInterface() && type.isAnnotationPresent(SPI.class)) {
              return null;
          }
  
          for (ApplicationContext context : CONTEXTS) {
              T bean = BeanFactoryUtils.getOptionalBean(context, name, type);
              if (bean != null) {
                  return bean;
              }
          }
  
          //logger.warn("No spring extension (bean) named:" + name + ", try to find an extension (bean) of type " + type.getName());
  
          return null;
      }
focal_method.class_method_signature: SpringExtensionFactory.getExtension(Class<T> type, String name)
focal_method.full_signature: @Override @SuppressWarnings("unchecked") public T getExtension(Class<T> type, String name)
focal_method.identifier: getExtension
focal_method.invocations: isInterface isAnnotationPresent getOptionalBean
focal_method.modifiers: @Override @SuppressWarnings("unchecked") public
focal_method.parameters: (Class<T> type, String name)
focal_method.return: T
focal_method.signature: T getExtension(Class<T> type, String name)