Upgrade to Tomcat 8.5.11
This commit is contained in:
@@ -0,0 +1 @@
|
||||
one sure is the loneliest number... that i'll ever know
|
||||
@@ -0,0 +1,3 @@
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
String message;
|
||||
|
||||
boolean active;
|
||||
|
||||
void init() {
|
||||
active = true;
|
||||
}
|
||||
|
||||
String getMessage() {
|
||||
if (!active && message != null) throw new java.lang.IllegalStateException();
|
||||
return message;
|
||||
}
|
||||
|
||||
void setMessage(String aMessage) {
|
||||
message = aMessage;
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
message = null;
|
||||
active = false;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.scripting.TestBeanAwareMessenger;
|
||||
|
||||
public class MyMessenger implements TestBeanAwareMessenger {
|
||||
|
||||
private String message;
|
||||
|
||||
private TestBean testBean;
|
||||
|
||||
private boolean active;
|
||||
|
||||
public void init() {
|
||||
active = true;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
if (!active && message != null) throw new java.lang.IllegalStateException();
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String aMessage) {
|
||||
message = aMessage;
|
||||
}
|
||||
|
||||
public TestBean getTestBean() {
|
||||
return testBean;
|
||||
}
|
||||
|
||||
public void setTestBean(TestBean tb) {
|
||||
testBean = tb;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
message = null;
|
||||
active = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import org.springframework.scripting.Messenger;
|
||||
|
||||
public class MyMessenger implements Messenger {
|
||||
|
||||
private String message;
|
||||
|
||||
private boolean active;
|
||||
|
||||
public void init() {
|
||||
active = true;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
if (!active && message != null) throw new java.lang.IllegalStateException();
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String aMessage) {
|
||||
message = aMessage;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
message = null;
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
|
||||
return new MyMessenger() ;
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">
|
||||
|
||||
<lang:bsh id="messenger" script-source="classpath:org/springframework/scripting/bsh/Messenger.bsh"
|
||||
script-interfaces="org.springframework.scripting.Messenger"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:bsh>
|
||||
|
||||
<lang:bsh id="messengerPrototype" script-source="classpath:org/springframework/scripting/bsh/Messenger.bsh"
|
||||
script-interfaces="org.springframework.scripting.ConfigurableMessenger"
|
||||
scope="prototype" init-method="init" destroy-method="destroy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:bsh>
|
||||
|
||||
<lang:bsh id="messengerImpl" script-source="classpath:org/springframework/scripting/bsh/MessengerImpl.bsh"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:bsh>
|
||||
|
||||
<lang:bsh id="messengerInstance" script-source="classpath:org/springframework/scripting/bsh/MessengerInstance.bsh"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:bsh>
|
||||
|
||||
<lang:bsh id="messengerByType" script-source="classpath:org/springframework/scripting/bsh/MessengerImpl.bsh"
|
||||
autowire="byType" init-method="init" destroy-method="destroy">
|
||||
</lang:bsh>
|
||||
|
||||
<lang:bsh id="messengerByName" script-source="classpath:org/springframework/scripting/bsh/MessengerImpl.bsh"
|
||||
autowire="byName" init-method="init" destroy-method="destroy">
|
||||
</lang:bsh>
|
||||
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
<lang:bsh id="calculator" script-interfaces="org.springframework.scripting.Calculator">
|
||||
<lang:inline-script>
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
</lang:inline-script>
|
||||
</lang:bsh>
|
||||
|
||||
<lang:bsh id="refreshableMessenger" script-interfaces="org.springframework.scripting.Messenger"
|
||||
script-source="classpath:org/springframework/scripting/bsh/Messenger.bsh" refresh-check-delay="5000"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:bsh>
|
||||
|
||||
<lang:bsh id="eventListener" script-interfaces="org.springframework.context.ApplicationListener,org.springframework.scripting.Messenger" >
|
||||
<lang:inline-script><![CDATA[
|
||||
int count;
|
||||
void onApplicationEvent (org.springframework.context.ApplicationEvent event) { count++; System.out.println(event); }
|
||||
String getMessage() { return "count=" + count; }
|
||||
]]></lang:inline-script>
|
||||
</lang:bsh>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
|
||||
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
|
||||
<beans>
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="broken" class="org.springframework.scripting.bsh.BshScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/Broken.bsh"/>
|
||||
<constructor-arg value="org.springframework.scripting.Messenger"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
|
||||
<beans default-lazy-init="true">
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="calculator" class="org.springframework.scripting.bsh.BshScriptFactory">
|
||||
<constructor-arg>
|
||||
<value>inline:
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
</value>
|
||||
</constructor-arg>
|
||||
<constructor-arg value="org.springframework.scripting.Calculator"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.bsh.BshScriptFactory"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/Messenger.bsh"/>
|
||||
<constructor-arg value="org.springframework.scripting.Messenger"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerWithConfig" class="org.springframework.scripting.bsh.BshScriptFactory"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/Messenger.bsh"/>
|
||||
<constructor-arg value="org.springframework.scripting.ConfigurableMessenger"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerWithConfigExtra" class="org.springframework.scripting.bsh.BshScriptFactory"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/Messenger.bsh"/>
|
||||
<constructor-arg value="org.springframework.scripting.Messenger,org.springframework.scripting.ConfigurableMessenger"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerInstance" class="org.springframework.scripting.bsh.BshScriptFactory"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/MessengerInstance.bsh"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerInstanceWithExplicitInterface" class="org.springframework.scripting.bsh.BshScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/MessengerInstance.bsh"/>
|
||||
<constructor-arg value="org.springframework.scripting.Messenger"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerImpl" class="org.springframework.scripting.bsh.BshScriptFactory"
|
||||
init-method="init" destroy-method="destroy">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/MessengerImpl.bsh"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerImplWithExplicitInterface" class="org.springframework.scripting.bsh.BshScriptFactory"
|
||||
init-method="init">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/MessengerImpl.bsh"/>
|
||||
<constructor-arg value="org.springframework.scripting.Messenger"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerPrototype" class="org.springframework.scripting.bsh.BshScriptFactory" scope="prototype"
|
||||
init-method="init">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/MessengerImpl.bsh"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
|
||||
<beans default-lazy-init="true">
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor">
|
||||
<property name="defaultRefreshCheckDelay" value="1"/>
|
||||
</bean>
|
||||
|
||||
<bean id="calculator" class="org.springframework.scripting.bsh.BshScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/Calculator.bsh"/>
|
||||
<constructor-arg value="org.springframework.scripting.Calculator"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.bsh.BshScriptFactory" init-method="init">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/MessengerImpl.bsh"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerPrototype" class="org.springframework.scripting.bsh.BshScriptFactory"
|
||||
scope="prototype" init-method="init">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/bsh/MessengerImpl.bsh"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1 @@
|
||||
return 3 * 2;
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.springframework.scripting.config
|
||||
|
||||
class TestBean implements ITestBean {
|
||||
|
||||
ITestBean otherBean
|
||||
|
||||
boolean initialized
|
||||
|
||||
boolean destroyed
|
||||
|
||||
void setOtherBean(ITestBean otherBean) {
|
||||
this.otherBean = otherBean;
|
||||
}
|
||||
|
||||
void startup() { this.initialized = true }
|
||||
|
||||
void shutdown() { this.destroyed = true }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/lang
|
||||
http://www.springframework.org/schema/lang/spring-lang-3.1.xsd"
|
||||
default-autowire="byName"
|
||||
default-init-method="startup"
|
||||
default-destroy-method="shutdown">
|
||||
|
||||
<lang:defaults refresh-check-delay="5000" proxy-target-class="true"/>
|
||||
|
||||
<lang:groovy id="testBean" name="/url" script-source="classpath:org/springframework/scripting/config/TestBean.groovy"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/lang
|
||||
http://www.springframework.org/schema/lang/spring-lang-3.0.xsd"
|
||||
default-autowire="byName"
|
||||
default-init-method="startup"
|
||||
default-destroy-method="shutdown">
|
||||
|
||||
<lang:defaults refresh-check-delay="5000"/>
|
||||
|
||||
<lang:groovy id="testBean" name="/url" script-source="classpath:org/springframework/scripting/config/TestBean.groovy"/>
|
||||
|
||||
<lang:groovy id="nonRefreshableTestBean" refresh-check-delay="-1"
|
||||
script-source="classpath:org/springframework/scripting/config/TestBean.groovy"/>
|
||||
|
||||
<bean id="otherBean" class="org.springframework.scripting.config.OtherTestBean"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,14 @@
|
||||
I have eaten
|
||||
the plums
|
||||
that were in
|
||||
the icebox
|
||||
|
||||
and which
|
||||
you were probably
|
||||
saving
|
||||
for breakfast
|
||||
|
||||
Forgive me
|
||||
they were delicious
|
||||
so sweet
|
||||
and so cold
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import org.springframework.scripting.Calculator
|
||||
|
||||
class GroovyCalculator implements Calculator {
|
||||
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import org.springframework.scripting.CallCounter;
|
||||
|
||||
class GroovyCallCounter implements CallCounter {
|
||||
|
||||
int count = -100;
|
||||
|
||||
void init() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
void before() {
|
||||
count++;
|
||||
}
|
||||
|
||||
int getCalls() {
|
||||
return count;
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
count = -200;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import org.springframework.scripting.Calculator
|
||||
|
||||
class DelegatingCalculator implements Calculator {
|
||||
|
||||
def Calculator delegate;
|
||||
|
||||
int add(int x, int y) {
|
||||
//println "hello"
|
||||
//println this.metaClass.getClass()
|
||||
//println delegate.metaClass.getClass()
|
||||
//delegate.metaClass.invokeMethod("add", [x,y])
|
||||
|
||||
delegate.callMissingMethod()
|
||||
|
||||
return delegate.add(x,y)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd">
|
||||
|
||||
<aop:config >
|
||||
<aop:advisor id="logUserAdvisor" pointcut="@within(org.springframework.scripting.groovy.Log)" advice-ref="logUserAdvice"/>
|
||||
</aop:config>
|
||||
|
||||
<bean id="logUserAdvice" class="org.springframework.scripting.groovy.LogUserAdvice" />
|
||||
|
||||
<!-- N.B. the pointcut never matches if refresh-delay is set (because proxy-target-class is always false) -->
|
||||
<lang:groovy id="groovyBean" script-source="classpath:/org/springframework/scripting/groovy/GroovyServiceImpl.grv" refresh-check-delay="1000"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd">
|
||||
|
||||
<aop:config >
|
||||
<aop:advisor id="logUserAdvisor" pointcut="@within(org.springframework.scripting.groovy.Log)" advice-ref="logUserAdvice"/>
|
||||
</aop:config>
|
||||
|
||||
<bean id="logUserAdvice" class="org.springframework.scripting.groovy.LogUserAdvice" />
|
||||
|
||||
<lang:groovy id="groovyBean" script-source="classpath:/org/springframework/scripting/groovy/GroovyServiceImpl.grv"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd">
|
||||
|
||||
<aop:config >
|
||||
<aop:advisor id="logUserAdvisor" pointcut="@within(org.springframework.scripting.groovy.Log)" advice-ref="logUserAdvice"/>
|
||||
</aop:config>
|
||||
|
||||
<bean id="logUserAdvice" class="org.springframework.scripting.groovy.LogUserAdvice" />
|
||||
|
||||
<lang:groovy id="groovyBean" script-source="classpath:/org/springframework/scripting/groovy/GroovyServiceImpl.grv" refresh-check-delay="1000" proxy-target-class="true"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
|
||||
|
||||
<aop:config >
|
||||
<aop:advisor id="logUserAdvisor" pointcut="@within(org.springframework.scripting.groovy.Log)" advice-ref="logUserAdvice"/>
|
||||
</aop:config>
|
||||
|
||||
<bean id="logUserAdvice" class="org.springframework.scripting.groovy.LogUserAdvice" />
|
||||
|
||||
<bean id="javaBean" class="org.springframework.scripting.groovy.TestServiceImpl"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
@Log
|
||||
public class GroovyServiceImpl implements TestService {
|
||||
|
||||
public String sayHello() {
|
||||
throw new TestException("GroovyServiceImpl");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
class GroovyMessenger2 extends ConcreteMessenger {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import org.springframework.scripting.Messenger
|
||||
|
||||
class GroovyMessenger implements Messenger {
|
||||
|
||||
GroovyMessenger() {
|
||||
println "GroovyMessenger"
|
||||
}
|
||||
|
||||
def String message;
|
||||
}
|
||||
|
||||
return new GroovyMessenger();
|
||||
@@ -0,0 +1,23 @@
|
||||
import org.springframework.context.ApplicationContext
|
||||
import org.springframework.context.ApplicationContextAware
|
||||
import org.springframework.scripting.ContextScriptBean
|
||||
import org.springframework.tests.sample.beans.TestBean
|
||||
|
||||
class GroovyScriptBean implements ContextScriptBean, ApplicationContextAware {
|
||||
|
||||
private int age
|
||||
|
||||
int getAge() {
|
||||
return this.age
|
||||
}
|
||||
|
||||
void setAge(int age) {
|
||||
this.age = age
|
||||
}
|
||||
|
||||
def String name
|
||||
|
||||
def TestBean testBean;
|
||||
|
||||
def ApplicationContext applicationContext
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import org.springframework.beans.factory.FactoryBean
|
||||
|
||||
class TestFactoryBean implements FactoryBean {
|
||||
|
||||
public boolean isSingleton() {
|
||||
true
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
String.class
|
||||
}
|
||||
|
||||
public Object getObject() {
|
||||
"test"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.xsd">
|
||||
|
||||
<lang:groovy id="calculator"
|
||||
script-source="classpath:org/springframework/scripting/groovy/Calculator.groovy"
|
||||
customizer-ref="testCustomizer" />
|
||||
|
||||
<bean id="testCustomizer" class="org.springframework.scripting.groovy.GroovyScriptFactoryTests$TestCustomizer"/>
|
||||
|
||||
<lang:groovy id="delegatingCalculator"
|
||||
script-source="classpath:org/springframework/scripting/groovy/DelegatingCalculator.groovy">
|
||||
<lang:property name="delegate" ref="calculator"/>
|
||||
</lang:groovy>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
|
||||
<beans>
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
|
||||
<bean id="calculator" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Calculator.groovy"/>
|
||||
<constructor-arg>
|
||||
<bean class="org.springframework.scripting.groovy.GroovyScriptFactoryTests$TestCustomizer" />
|
||||
</constructor-arg>
|
||||
|
||||
</bean>
|
||||
|
||||
<bean id="delegatingCalculator" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/DelegatingCalculator.groovy"/>
|
||||
|
||||
<property name="delegate" ref="calculator"/>
|
||||
|
||||
</bean>
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">
|
||||
|
||||
<lang:groovy id="bean" script-source="classpath:org/springframework/scripting/groovy/ScriptBean.groovy" autowire="byType">
|
||||
<lang:property name="name" value="Sophie Marceau"/>
|
||||
<lang:property name="age" value="31"/>
|
||||
</lang:groovy>
|
||||
|
||||
<lang:groovy id="bean2" script-source="classpath:org/springframework/scripting/groovy/ScriptBean.groovy" autowire="byName">
|
||||
<lang:property name="name" value="Sophie Marceau"/>
|
||||
<lang:property name="age" value="31"/>
|
||||
</lang:groovy>
|
||||
|
||||
<lang:groovy id="bean3" script-source="classpath:org/springframework/scripting/groovy/ScriptBean.groovy" scope="prototype">
|
||||
<lang:property name="name" value="Sophie Marceau"/>
|
||||
<lang:property name="age" value="31"/>
|
||||
</lang:groovy>
|
||||
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.2.xsd">
|
||||
|
||||
<lang:std id="messenger" script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:std>
|
||||
|
||||
<lang:std id="messengerWithInterface" script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy"
|
||||
script-interfaces="org.springframework.scripting.Messenger"/>
|
||||
|
||||
<lang:std id="refreshableMessenger" refresh-check-delay="5000"
|
||||
script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:std>
|
||||
|
||||
<lang:std id="inlineMessenger" engine="Groovy">
|
||||
<lang:inline-script>
|
||||
package org.springframework.scripting.groovy;
|
||||
import org.springframework.scripting.Messenger
|
||||
class GroovyMessenger implements Messenger {
|
||||
def String message;
|
||||
}
|
||||
return new GroovyMessenger();
|
||||
</lang:inline-script>
|
||||
</lang:std>
|
||||
|
||||
<lang:std id="inlineMessengerWithInterface" engine="Groovy" script-interfaces="org.springframework.scripting.Messenger">
|
||||
<lang:inline-script>
|
||||
package org.springframework.scripting.groovy;
|
||||
import org.springframework.scripting.Messenger
|
||||
class GroovyMessenger implements Messenger {
|
||||
def String message;
|
||||
}
|
||||
return new GroovyMessenger();
|
||||
</lang:inline-script>
|
||||
</lang:std>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd">
|
||||
|
||||
<lang:groovy id="refreshableMessenger" refresh-check-delay="5000" proxy-target-class="true"
|
||||
script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:groovy>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">
|
||||
|
||||
<aop:config>
|
||||
<aop:aspect ref="getMessageAspect">
|
||||
<aop:before method="before" pointcut="execution(* *..Messenger.*(..))"/>
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
<lang:groovy id="getMessageAspect" script-source="classpath:org/springframework/scripting/groovy/CallCounter.groovy"
|
||||
init-method="init" destroy-method="destroy"/>
|
||||
|
||||
<lang:groovy id="messenger" script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:groovy>
|
||||
|
||||
<lang:groovy id="messengerPrototype" script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy"
|
||||
scope="prototype">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:groovy>
|
||||
|
||||
<lang:groovy id="calculator" depends-on="messenger" customizer-ref="groovyObjectCustomizer">
|
||||
<lang:inline-script>
|
||||
package org.springframework.scripting.groovy;
|
||||
import org.springframework.scripting.Calculator
|
||||
class GroovyCalculator implements Calculator {
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
}
|
||||
</lang:inline-script>
|
||||
</lang:groovy>
|
||||
|
||||
<lang:groovy id="groovyObjectCustomizer" customizer-ref="importCustomizer">
|
||||
<lang:inline-script><![CDATA[
|
||||
public class TestCustomizer implements GroovyObjectCustomizer {
|
||||
public void customize(GroovyObject go) {
|
||||
println "customizing ${go}..."
|
||||
}
|
||||
}]]>
|
||||
</lang:inline-script>
|
||||
</lang:groovy>
|
||||
|
||||
<bean id="importCustomizer" class="org.springframework.scripting.groovy.MyImportCustomizer"/>
|
||||
|
||||
<lang:groovy id="refreshableMessenger" refresh-check-delay="5000"
|
||||
script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:groovy>
|
||||
|
||||
<lang:groovy script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy"
|
||||
customizer-ref="compilerConfiguration">
|
||||
<lang:property name="message" value="Hello World!"/>
|
||||
</lang:groovy>
|
||||
|
||||
<bean id="compilerConfiguration" class="org.codehaus.groovy.control.CompilerConfiguration">
|
||||
<property name="bytecodePostprocessor" ref="bytecodeProcessor"/>
|
||||
</bean>
|
||||
|
||||
<bean id="bytecodeProcessor" class="org.springframework.scripting.groovy.MyBytecodeProcessor"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
|
||||
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
|
||||
<beans>
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="broken" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Broken.groovyb"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/lang
|
||||
http://www.springframework.org/schema/lang/spring-lang.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="calculator" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg>
|
||||
<value>inline:
|
||||
package org.springframework.scripting.groovy;
|
||||
import org.springframework.scripting.Calculator
|
||||
class GroovyCalculator implements Calculator {
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
}
|
||||
</value>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Messenger.groovy"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerPrototype" class="org.springframework.scripting.groovy.GroovyScriptFactory"
|
||||
scope="prototype">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Messenger.groovy"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerInstance" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/MessengerInstance.groovy"/>
|
||||
<property name="message" ref="myMessage"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerInstanceInline" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg>
|
||||
<value>inline:
|
||||
package org.springframework.scripting.groovy;
|
||||
import org.springframework.scripting.Messenger
|
||||
class GroovyMessenger implements Messenger {
|
||||
def String message;
|
||||
}
|
||||
return new GroovyMessenger();
|
||||
</value>
|
||||
</constructor-arg>
|
||||
<property name="message" ref="myMessage"/>
|
||||
</bean>
|
||||
|
||||
<bean id="myMessage" class="java.lang.String">
|
||||
<constructor-arg value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<lang:groovy id="refreshableFactory" refresh-check-delay="5000"
|
||||
script-source="org/springframework/scripting/groovy/TestFactoryBean.groovy"/>
|
||||
|
||||
<lang:groovy id="factory" script-source="classpath:org/springframework/scripting/groovy/TestFactoryBean.groovy"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="calculator" class="org.springframework.scripting.support.StandardScriptFactory">
|
||||
<constructor-arg value="Groovy"/>
|
||||
<constructor-arg>
|
||||
<value>inline:
|
||||
package org.springframework.scripting.groovy;
|
||||
import org.springframework.scripting.Calculator
|
||||
class GroovyCalculator implements Calculator {
|
||||
int add(int x, int y) {
|
||||
return x + y;
|
||||
}
|
||||
}
|
||||
</value>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.support.StandardScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Messenger.groovy"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerPrototype" class="org.springframework.scripting.support.StandardScriptFactory"
|
||||
scope="prototype">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Messenger.groovy"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerInstance" class="org.springframework.scripting.support.StandardScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/MessengerInstance.groovy"/>
|
||||
<property name="message" ref="myMessage"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerInstanceInline" class="org.springframework.scripting.support.StandardScriptFactory">
|
||||
<constructor-arg value="Groovy"/>
|
||||
<constructor-arg>
|
||||
<value>inline:
|
||||
package org.springframework.scripting.groovy;
|
||||
import org.springframework.scripting.Messenger
|
||||
class GroovyMessenger implements Messenger {
|
||||
def String message;
|
||||
}
|
||||
return new GroovyMessenger();
|
||||
</value>
|
||||
</constructor-arg>
|
||||
<property name="message" ref="myMessage"/>
|
||||
</bean>
|
||||
|
||||
<bean id="myMessage" class="java.lang.String">
|
||||
<constructor-arg value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
|
||||
<beans default-lazy-init="true">
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor">
|
||||
<property name="defaultRefreshCheckDelay" value="1"/>
|
||||
</bean>
|
||||
|
||||
<bean id="calculator" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Calculator.groovy"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Messenger.groovy"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messengerPrototype" class="org.springframework.scripting.groovy.GroovyScriptFactory" scope="prototype">
|
||||
<constructor-arg value="classpath:org/springframework/scripting/groovy/Messenger.groovy"/>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
<beans>
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg>
|
||||
<!-- 'inline:' prefix is preceded by whitespace... -->
|
||||
<value>
|
||||
inline:
|
||||
|
||||
class Bingo {
|
||||
|
||||
@Property String message;
|
||||
}
|
||||
</value>
|
||||
</constructor-arg>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1 @@
|
||||
return 3 * 2
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
<beans>
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg>
|
||||
<value>inline:
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import org.springframework.scripting.Messenger;
|
||||
|
||||
class GroovyMessenger implements Messenger {
|
||||
|
||||
def String message;
|
||||
}
|
||||
|
||||
class Bingo {
|
||||
|
||||
def String message;
|
||||
}
|
||||
</value>
|
||||
</constructor-arg>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
<beans>
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg>
|
||||
<value>inline:
|
||||
package org.springframework.scripting.groovy;
|
||||
|
||||
import org.springframework.scripting.Messenger;
|
||||
|
||||
class Bingo {
|
||||
|
||||
@Property String message;
|
||||
}
|
||||
|
||||
class GroovyMessenger implements Messenger {
|
||||
|
||||
@Property String message;
|
||||
}
|
||||
</value>
|
||||
</constructor-arg>
|
||||
<property name="message" value="Hello World!"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1 @@
|
||||
function getMessage() { return "Hello World!" }
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
|
||||
|
||||
<beans>
|
||||
|
||||
<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>
|
||||
|
||||
<bean id="messenger" class="org.springframework.scripting.groovy.GroovyScriptFactory">
|
||||
<constructor-arg>
|
||||
<value>inline:package org.springframework.scripting;
|
||||
|
||||
import org.springframework.scripting.Messenger
|
||||
|
||||
class DelegatingMessenger implements Messenger {
|
||||
|
||||
private Messenger wrappedMessenger;
|
||||
|
||||
public String getMessage() {
|
||||
this.wrappedMessenger.getMessage();
|
||||
}
|
||||
|
||||
public void setMessenger(Messenger wrappedMessenger) {
|
||||
this.wrappedMessenger = wrappedMessenger;
|
||||
}
|
||||
}</value>
|
||||
</constructor-arg>
|
||||
<property name="messenger" ref="wrappedMessenger"/>
|
||||
</bean>
|
||||
|
||||
<bean id="wrappedMessenger" class="org.springframework.scripting.support.StubMessenger"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.2.xsd">
|
||||
|
||||
<lang:std id="messengerWithInterface" script-source="classpath:org/springframework/scripting/support/Messenger.js"
|
||||
script-interfaces="org.springframework.scripting.Messenger"/>
|
||||
|
||||
<lang:std id="refreshableMessengerWithInterface" refresh-check-delay="5000"
|
||||
script-source="classpath:org/springframework/scripting/support/Messenger.js"
|
||||
script-interfaces="org.springframework.scripting.Messenger">
|
||||
</lang:std>
|
||||
|
||||
<lang:std id="inlineMessengerWithInterface" engine="JavaScript"
|
||||
script-interfaces="org.springframework.scripting.Messenger">
|
||||
<lang:inline-script>
|
||||
function getMessage() { return "Hello World!" }
|
||||
</lang:inline-script>
|
||||
</lang:std>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user