code: public void loadBeans(Resource[] resources) {
          @SuppressWarnings("rawtypes") Closure beans = new Closure(this) {
              private static final long serialVersionUID = -2778328821635253740L;
  
              @Override
              public Object call(Object... args) {
                  invokeBeanDefiningClosure((Closure)args[0]);
                  return null;
              }
          };
  
          Binding b = new Binding() {
              @Override
              public void setVariable(String name, Object value) {
                  if (currentBeanConfig == null) {
                      super.setVariable(name, value);
                  }
                  else {
                      setPropertyOnBeanConfig(name, value);
                  }
              }
          };
          b.setVariable("beans", beans);
  
          for (Resource resource : resources) {
              try {
                  GroovyShell shell = classLoader == null ? new GroovyShell(b) : new GroovyShell(classLoader, b);
                  shell.evaluate(new InputStreamReader(resource.getInputStream(), "UTF-8"));
              }
              catch (Throwable e) {
                  throw new BeanDefinitionParsingException(
                          new Problem("Error evaluating bean definition script: " + e.getMessage(), new Location(resource), null, e));
              }
          }
      }
docs: Loads a set of given beans
  @param resources The resources to load
  @throws IOException Thrown if there is an error reading one of the passes resources