List of usage examples for org.springframework.scripting ScriptFactory requiresConfigInterface
boolean requiresConfigInterface();
From source file:org.iff.infra.util.spring.script.ScriptFactoryPostProcessor.java
/** * Prepare the script beans in the internal BeanFactory that this * post-processor uses. Each original bean definition will be split * into a ScriptFactory definition and a scripted object definition. * @param bd the original bean definition in the main BeanFactory * @param scriptFactoryBeanName the name of the internal ScriptFactory bean * @param scriptedObjectBeanName the name of the internal scripted object bean *//*w ww.j a va2 s . co m*/ protected void prepareScriptBeans(BeanDefinition bd, String scriptFactoryBeanName, String scriptedObjectBeanName) { // Avoid recreation of the script bean definition in case of a prototype. synchronized (this.scriptBeanFactory) { if (!this.scriptBeanFactory.containsBeanDefinition(scriptedObjectBeanName)) { this.scriptBeanFactory.registerBeanDefinition(scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd)); ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); Class<?>[] interfaces = scriptFactory.getScriptInterfaces(); Class<?>[] scriptedInterfaces = interfaces; if (scriptFactory.requiresConfigInterface() && !bd.getPropertyValues().isEmpty()) { Class<?> configInterface = createConfigInterface(bd, interfaces); scriptedInterfaces = ObjectUtils.addObjectToArray(interfaces, configInterface); } BeanDefinition objectBd = createScriptedObjectBeanDefinition(bd, scriptFactoryBeanName, scriptSource, scriptedInterfaces); long refreshCheckDelay = resolveRefreshCheckDelay(bd); if (refreshCheckDelay >= 0) { objectBd.setScope(BeanDefinition.SCOPE_PROTOTYPE); } this.scriptBeanFactory.registerBeanDefinition(scriptedObjectBeanName, objectBd); } } }
From source file:org.springframework.scripting.support.ScriptFactoryPostProcessor.java
/** * Prepare the script beans in the internal BeanFactory that this * post-processor uses. Each original bean definition will be split * into a ScriptFactory definition and a scripted object definition. * @param bd the original bean definition in the main BeanFactory * @param scriptFactoryBeanName the name of the internal ScriptFactory bean * @param scriptedObjectBeanName the name of the internal scripted object bean *//* www .ja v a2 s. c om*/ protected void prepareScriptBeans(BeanDefinition bd, String scriptFactoryBeanName, String scriptedObjectBeanName) { // Avoid recreation of the script bean definition in case of a prototype. synchronized (this.scriptBeanFactory) { if (!this.scriptBeanFactory.containsBeanDefinition(scriptedObjectBeanName)) { this.scriptBeanFactory.registerBeanDefinition(scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd)); ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); Class<?>[] interfaces = scriptFactory.getScriptInterfaces(); Class<?>[] scriptedInterfaces = interfaces; if (scriptFactory.requiresConfigInterface() && !bd.getPropertyValues().isEmpty()) { Class<?> configInterface = createConfigInterface(bd, interfaces); scriptedInterfaces = ObjectUtils.addObjectToArray(interfaces, configInterface); } BeanDefinition objectBd = createScriptedObjectBeanDefinition(bd, scriptFactoryBeanName, scriptSource, scriptedInterfaces); long refreshCheckDelay = resolveRefreshCheckDelay(bd); if (refreshCheckDelay >= 0) { objectBd.setScope(BeanDefinition.SCOPE_PROTOTYPE); } this.scriptBeanFactory.registerBeanDefinition(scriptedObjectBeanName, objectBd); } } }