throw new IllegalArgumentException("script not exists : " + scriptLocation);
}
scriptLastModifiedMap.put(scriptLocation, scriptLastModified(scriptLocation));
// Create script factory bean definition.
GroovyScriptFactory groovyScriptFactory = new GroovyScriptFactory(scriptLocation);
groovyScriptFactory.setBeanFactory(beanFactory);
groovyScriptFactory.setBeanClassLoader(beanFactory.getBeanClassLoader());
Object controller =
groovyScriptFactory.getScriptedObject(new ResourceScriptSource(ctx.getResource(scriptLocation)));
String controllerBeanName = scriptLocation;
removeOldControllerMapping(controllerBeanName);
if (beanFactory.containsBean(controllerBeanName)) {
beanFactory.destroySingleton(controllerBeanName); //移除单例bean