docs: private BeanConfiguration invokeBeanDefiningMethod(String name, Object[] args) {
          BeanConfiguration old = currentBeanConfig;
          try {
              if(args[0] instanceof Class) {
                  Class beanClass = args[0] instanceof Class ? (Class)args[0] : args[0].getClass();
  
                  if(args.length >= 1) {
                      if(args[args.length-1] instanceof Closure) {
                          if(args.length-1 != 1) {
                              Object[] constructorArgs = ArrayUtils.subarray(args, 1, args.length-1);
                              filterGStringReferences(constructorArgs);
                              if(name.equals(ANONYMOUS_BEAN))
                                  currentBeanConfig = springConfig.createSingletonBean(beanClass,Arrays.asList(constructorArgs));
                              else
                                  currentBeanConfig = springConfig.addSingletonBean(name, beanClass, Arrays.asList(constructorArgs));
                          }
                          else {
                              if(name.equals(ANONYMOUS_BEAN))
                                  currentBeanConfig = springConfig.createSingletonBean(beanClass);
                              else
                                  currentBeanConfig = springConfig.addSingletonBean(name, beanClass);
                          }
                      }
                      else  {
                          Object[] constructorArgs = ArrayUtils.subarray(args, 1, args.length);
                          filterGStringReferences(constructorArgs);
                          if(name.equals(ANONYMOUS_BEAN))
                              currentBeanConfig = springConfig.createSingletonBean(beanClass,Arrays.asList(constructorArgs));
                          else
                              currentBeanConfig = springConfig.addSingletonBean(name, beanClass, Arrays.asList(constructorArgs));
                      }
  
                  }
              }
              else if(args[0] instanceof RuntimeBeanReference) {
                  currentBeanConfig = springConfig.addSingletonBean(name);
                  currentBeanConfig.setFactoryBean(((RuntimeBeanReference)args[0]).getBeanName());
              }
              else if(args[0] instanceof Map) {
                  currentBeanConfig = springConfig.addSingletonBean(name);
                  Map.Entry factoryBeanEntry = (Map.Entry)((Map)args[0]).entrySet().iterator().next();
                  currentBeanConfig.setFactoryBean(factoryBeanEntry.getKey().toString());
                  currentBeanConfig.setFactoryMethod(factoryBeanEntry.getValue().toString());
              }
              else if(args[0] instanceof Closure) {
                  currentBeanConfig = springConfig.addAbstractBean(name);
              }
              else {
                  Object[] constructorArgs;
                  if(args[args.length-1] instanceof Closure) {
                      constructorArgs= ArrayUtils.subarray(args, 0, args.length-1);
                  }
                  else {
                      constructorArgs= ArrayUtils.subarray(args, 0, args.length);
                  }
                  filterGStringReferences(constructorArgs);
                  currentBeanConfig = new DefaultBeanConfiguration(name, null, Arrays.asList(constructorArgs));
                  springConfig.addBeanConfiguration(name,currentBeanConfig);
              }
              if(args[args.length-1] instanceof Closure) {
                  Closure callable = (Closure)args[args.length-1];
                  callable.setDelegate(this);
                  callable.setResolveStrategy(Closure.DELEGATE_FIRST);
                  callable.call(new Object[]{currentBeanConfig});
  
              }
  
              return currentBeanConfig;
          } finally {
              currentBeanConfig = old;
          }
      }