/** * Obtain a ScriptSource for the given bean, lazily creating it * if not cached already. * @param beanName the name of the scripted bean * @param scriptSourceLocator the script source locator associated with the bean * @return the corresponding ScriptSource instance * @see #convertToScriptSource */ protected ScriptSource getScriptSource(String beanName, String scriptSourceLocator) { synchronized (this.scriptSourceCache) { ScriptSource scriptSource = this.scriptSourceCache.get(beanName); if (scriptSource == null) { scriptSource = convertToScriptSource(beanName, scriptSourceLocator, this.resourceLoader); this.scriptSourceCache.put(beanName, scriptSource); } return scriptSource; } }
scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd)); ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); Class<?>[] interfaces = scriptFactory.getScriptInterfaces(); 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);
String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName; String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName; prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); boolean isFactoryBean = false; try { long refreshCheckDelay = resolveRefreshCheckDelay(bd); if (refreshCheckDelay >= 0) { Class<?>[] interfaces = scriptFactory.getScriptInterfaces(); RefreshableScriptTargetSource ts = new RefreshableScriptTargetSource(this.scriptBeanFactory, scriptedObjectBeanName, scriptFactory, scriptSource, isFactoryBean); boolean proxyTargetClass = resolveProxyTargetClass(bd); String language = (String) bd.getAttribute(LANGUAGE_ATTRIBUTE); if (proxyTargetClass && (language == null || !language.equals("groovy"))) { return createRefreshableProxy(ts, interfaces, proxyTargetClass);
String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName; String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName; prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); Class<?>[] interfaces = scriptFactory.getScriptInterfaces(); return (interfaces.length == 1 ? interfaces[0] : createCompositeInterface(interfaces));
scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd)); ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class); Class<?> configInterface = createConfigInterface(bd, interfaces); scriptedInterfaces = ObjectUtils.addObjectToArray(interfaces, configInterface); BeanDefinition objectBd = createScriptedObjectBeanDefinition( bd, scriptFactoryBeanName, scriptSource, scriptedInterfaces); long refreshCheckDelay = resolveRefreshCheckDelay(bd);
RefreshableScriptTargetSource ts = new RefreshableScriptTargetSource(this.scriptBeanFactory, scriptedObjectBeanName, scriptFactory, scriptSource, isFactoryBean); boolean proxyTargetClass = resolveProxyTargetClass(bd); String language = (String) bd.getAttribute(LANGUAGE_ATTRIBUTE); if (proxyTargetClass && (language == null || !language.equals("groovy"))) { return createRefreshableProxy(ts, interfaces, proxyTargetClass);
String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName; String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName; prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); Class<?>[] interfaces = scriptFactory.getScriptInterfaces(); return (interfaces.length == 1 ? interfaces[0] : createCompositeInterface(interfaces));
scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd)); ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); Class<?>[] interfaces = scriptFactory.getScriptInterfaces(); 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);
String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName; String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName; prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName); ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator()); boolean isFactoryBean = false; try { long refreshCheckDelay = resolveRefreshCheckDelay(bd); if (refreshCheckDelay >= 0) { Class<?>[] interfaces = scriptFactory.getScriptInterfaces(); RefreshableScriptTargetSource ts = new RefreshableScriptTargetSource(this.scriptBeanFactory, scriptedObjectBeanName, scriptFactory, scriptSource, isFactoryBean); boolean proxyTargetClass = resolveProxyTargetClass(bd); String language = (String) bd.getAttribute(LANGUAGE_ATTRIBUTE); if (proxyTargetClass && (language == null || !language.equals("groovy"))) { return createRefreshableProxy(ts, interfaces, proxyTargetClass);
/** * Obtain a ScriptSource for the given bean, lazily creating it * if not cached already. * @param beanName the name of the scripted bean * @param scriptSourceLocator the script source locator associated with the bean * @return the corresponding ScriptSource instance * @see #convertToScriptSource */ protected ScriptSource getScriptSource(String beanName, String scriptSourceLocator) { synchronized (this.scriptSourceCache) { ScriptSource scriptSource = this.scriptSourceCache.get(beanName); if (scriptSource == null) { scriptSource = convertToScriptSource(beanName, scriptSourceLocator, this.resourceLoader); this.scriptSourceCache.put(beanName, scriptSource); } return scriptSource; } }
/** * Obtain a ScriptSource for the given bean, lazily creating it * if not cached already. * @param beanName the name of the scripted bean * @param scriptSourceLocator the script source locator associated with the bean * @return the corresponding ScriptSource instance * @see #convertToScriptSource */ protected ScriptSource getScriptSource(String beanName, String scriptSourceLocator) { synchronized (this.scriptSourceCache) { ScriptSource scriptSource = this.scriptSourceCache.get(beanName); if (scriptSource == null) { scriptSource = convertToScriptSource(beanName, scriptSourceLocator, this.resourceLoader); this.scriptSourceCache.put(beanName, scriptSource); } return scriptSource; } }