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));
}