20 changed files with 0 additions and 597 deletions
@ -1,16 +0,0 @@ |
|||||||
<?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 id="testBeanTarget" class="org.springframework.tests.sample.beans.TestBean" scope="prototype"/> |
|
||||||
|
|
||||||
<bean id="targetSource" class="org.springframework.aop.target.CommonsPoolTargetSource"> |
|
||||||
<property name="targetBeanName" value="testBeanTarget"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="testBean" class="org.springframework.aop.framework.ProxyFactoryBean"> |
|
||||||
<property name="targetSource" ref="targetSource"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,69 +0,0 @@ |
|||||||
<?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 id="prototypeTest" class="org.springframework.tests.sample.beans.SideEffectBean" scope="prototype"> |
|
||||||
<property name="count"><value>10</value></property> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="poolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource"> |
|
||||||
<property name="targetBeanName"><value>prototypeTest</value></property> |
|
||||||
<property name="maxSize"><value>25</value></property> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="poolConfigAdvisor" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> |
|
||||||
<property name="targetObject"><ref local="poolTargetSource" /></property> |
|
||||||
<property name="targetMethod"><value>getPoolingConfigMixin</value></property> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="nop" class="org.springframework.tests.aop.interceptor.NopInterceptor"/> |
|
||||||
|
|
||||||
<!-- |
|
||||||
This will create a bean for each thread ("apartment") |
|
||||||
--> |
|
||||||
<bean id="pooled" class="org.springframework.aop.framework.ProxyFactoryBean"> |
|
||||||
<property name="targetSource"><ref local="poolTargetSource"/></property> |
|
||||||
<property name="interceptorNames"><value>nop</value></property> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="pooledNoInterceptors" class="org.springframework.aop.framework.ProxyFactoryBean"> |
|
||||||
<property name="targetSource"><ref local="poolTargetSource"/></property> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="pooledWithMixin" class="org.springframework.aop.framework.ProxyFactoryBean"> |
|
||||||
<property name="targetSource"><ref local="poolTargetSource"/></property> |
|
||||||
<property name="interceptorNames"><value>poolConfigAdvisor</value></property> |
|
||||||
<!-- Necessary as have a mixin and want to avoid losing the class, |
|
||||||
because there's no target interface --> |
|
||||||
<property name="proxyTargetClass"><value>true</value></property> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<!-- Serialization tests using serializable target and advice --> |
|
||||||
<bean id="serializableNop" class="org.springframework.tests.aop.interceptor.SerializableNopInterceptor" /> |
|
||||||
|
|
||||||
<bean id="prototypePerson" class="org.springframework.tests.sample.beans.SerializablePerson" scope="prototype"/> |
|
||||||
|
|
||||||
<bean id="personPoolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource"> |
|
||||||
<property name="targetBeanName"><value>prototypePerson</value></property> |
|
||||||
<property name="maxSize"><value>10</value></property> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="pooledPerson" class="org.springframework.aop.framework.ProxyFactoryBean"> |
|
||||||
<property name="targetSource"><ref local="personPoolTargetSource"/></property> |
|
||||||
<property name="interceptorNames"><value>serializableNop</value></property> |
|
||||||
|
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="maxSizePooledPerson" class="org.springframework.aop.framework.ProxyFactoryBean"> |
|
||||||
<property name="targetSource"> |
|
||||||
<bean class="org.springframework.aop.target.CommonsPoolTargetSource"> |
|
||||||
<property name="targetBeanName" value="prototypePerson"/> |
|
||||||
<property name="maxSize" value="10"/> |
|
||||||
<property name="maxWait" value="1"/> |
|
||||||
</bean> |
|
||||||
</property> |
|
||||||
<property name="interceptorNames"><value>serializableNop</value></property> |
|
||||||
</bean> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?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:defaults proxy-target-class="true"/> |
|
||||||
|
|
||||||
<lang:jruby id="refreshableMessenger" refresh-check-delay="1000" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/Messenger.rb" |
|
||||||
script-interfaces="org.springframework.scripting.Messenger"> |
|
||||||
<lang:property name="message" value="Hello World!"/> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,21 +0,0 @@ |
|||||||
<?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="apc" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> |
|
||||||
<property name="beanNames" value="messenger"/> |
|
||||||
<property name="interceptorNames" value="advice"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="messenger" class="org.springframework.scripting.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/Messenger.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.Messenger"/> |
|
||||||
<property name="message" value="Hello World!"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="advice" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,21 +0,0 @@ |
|||||||
<?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="messengerTarget" class="org.springframework.scripting.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/Messenger.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.Messenger"/> |
|
||||||
<property name="message" value="Hello World!"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="messenger" class="org.springframework.aop.framework.ProxyFactoryBean"> |
|
||||||
<property name="target" ref="messengerTarget"/> |
|
||||||
<property name="interceptorNames" value="advice"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="advice" class="org.springframework.tests.aop.advice.CountingBeforeAdvice"/> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,4 +0,0 @@ |
|||||||
In A Station Of The Metro |
|
||||||
|
|
||||||
the apparition of these faces in the crowd |
|
||||||
petals on a wet black bough |
|
||||||
@ -1,9 +0,0 @@ |
|||||||
require 'java' |
|
||||||
|
|
||||||
class RubyCalculator |
|
||||||
include org.springframework.scripting.Calculator |
|
||||||
|
|
||||||
def add(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,21 +0,0 @@ |
|||||||
require 'java' |
|
||||||
|
|
||||||
class RubyMessenger |
|
||||||
include org.springframework.scripting.Messenger |
|
||||||
|
|
||||||
def setMessage(message) |
|
||||||
@@message = message |
|
||||||
end |
|
||||||
|
|
||||||
def getMessage |
|
||||||
@@message |
|
||||||
end |
|
||||||
|
|
||||||
def setTestBean(testBean) |
|
||||||
@@testBean = testBean |
|
||||||
end |
|
||||||
|
|
||||||
def getTestBean |
|
||||||
@@testBean |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,25 +0,0 @@ |
|||||||
require 'java' |
|
||||||
|
|
||||||
class RubyMessenger |
|
||||||
include org.springframework.scripting.ConfigurableMessenger |
|
||||||
|
|
||||||
@@message = "Hello World!" |
|
||||||
|
|
||||||
def setMessage(message) |
|
||||||
@@message = message |
|
||||||
end |
|
||||||
|
|
||||||
def getMessage |
|
||||||
@@message |
|
||||||
end |
|
||||||
|
|
||||||
def setTestBean(testBean) |
|
||||||
@@testBean = testBean |
|
||||||
end |
|
||||||
|
|
||||||
def getTestBean |
|
||||||
@@testBean |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
RubyMessenger.new |
|
||||||
@ -1,9 +0,0 @@ |
|||||||
require 'java' |
|
||||||
|
|
||||||
class RubyPrinter |
|
||||||
include org.springframework.scripting.jruby.Printer |
|
||||||
|
|
||||||
def print(obj) |
|
||||||
puts obj.getContent |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
require 'java' |
|
||||||
|
|
||||||
class RubyPrinter |
|
||||||
include org.springframework.scripting.jruby.Printer |
|
||||||
|
|
||||||
def print(obj) |
|
||||||
puts obj.getContent |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
RubyPrinter.new |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?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" |
|
||||||
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.0.xsd |
|
||||||
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.xsd |
|
||||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> |
|
||||||
|
|
||||||
<lang:jruby id="messenger" |
|
||||||
script-interfaces="org.springframework.scripting.Messenger" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/Messenger.rb"> |
|
||||||
<lang:property name="message" value="Hello World!"/> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
<aop:config> |
|
||||||
<aop:pointcut id="messengerOps" |
|
||||||
expression="execution(String org.springframework.scripting.Messenger.*())"/> |
|
||||||
<aop:aspect id="scramblerAspect" ref="scrambler"> |
|
||||||
<aop:around pointcut-ref="messengerOps" |
|
||||||
method="scramble"/> |
|
||||||
</aop:aspect> |
|
||||||
</aop:config> |
|
||||||
|
|
||||||
<bean id="scrambler" class="org.springframework.scripting.MessengerScrambler"/> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,32 +0,0 @@ |
|||||||
<?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-4.2.xsd"> |
|
||||||
|
|
||||||
<lang:std id="messenger" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/MessengerWithInstance.rb"> |
|
||||||
</lang:std> |
|
||||||
|
|
||||||
<lang:std id="calculator" engine="jruby"> |
|
||||||
<lang:inline-script> |
|
||||||
require 'java' |
|
||||||
|
|
||||||
class RubyCalculator |
|
||||||
include org.springframework.scripting.Calculator |
|
||||||
|
|
||||||
def add(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
RubyCalculator.new |
|
||||||
</lang:inline-script> |
|
||||||
</lang:std> |
|
||||||
|
|
||||||
<lang:std id="refreshableMessenger" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/MessengerWithInstance.rb" |
|
||||||
refresh-check-delay="5000"> |
|
||||||
</lang:std> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,79 +0,0 @@ |
|||||||
<?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:jruby id="messenger" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/Messenger.rb" |
|
||||||
script-interfaces="org.springframework.scripting.Messenger"> |
|
||||||
<lang:property name="message" value="Hello World!"/> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
<lang:jruby id="messengerPrototype" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/Messenger.rb" |
|
||||||
script-interfaces="org.springframework.scripting.ConfigurableMessenger" scope="prototype"> |
|
||||||
<lang:property name="message" value="Hello World!"/> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
<lang:jruby id="messengerByType" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/Messenger.rb" |
|
||||||
script-interfaces="org.springframework.scripting.TestBeanAwareMessenger" scope="prototype" |
|
||||||
autowire="byType" dependency-check="objects"> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
<lang:jruby id="messengerByName" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/Messenger.rb" |
|
||||||
script-interfaces="org.springframework.scripting.TestBeanAwareMessenger" scope="prototype" |
|
||||||
autowire="byName"> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean"/> |
|
||||||
|
|
||||||
<lang:jruby id="calculator" |
|
||||||
script-interfaces="org.springframework.scripting.Calculator"> |
|
||||||
<lang:inline-script> |
|
||||||
require 'java' |
|
||||||
|
|
||||||
class RubyCalculator |
|
||||||
include org.springframework.scripting.Calculator |
|
||||||
|
|
||||||
def add(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
end |
|
||||||
</lang:inline-script> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
<lang:jruby id="refreshableMessenger" |
|
||||||
script-source="classpath:org/springframework/scripting/jruby/Messenger.rb" |
|
||||||
script-interfaces="org.springframework.scripting.Messenger" |
|
||||||
refresh-check-delay="5000"> |
|
||||||
<lang:property name="message" value="Hello World!"/> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
<!-- just checking that multiple script interfaces are supported --> |
|
||||||
<lang:jruby id="calculatingMessenger" |
|
||||||
script-interfaces="org.springframework.scripting.Calculator, org.springframework.scripting.Messenger"> |
|
||||||
<lang:inline-script><![CDATA[require 'java' |
|
||||||
|
|
||||||
class RubyCalculatingMessenger |
|
||||||
|
|
||||||
def add(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def setMessage(message) |
|
||||||
@@message = message |
|
||||||
end |
|
||||||
|
|
||||||
def getMessage |
|
||||||
@@message |
|
||||||
end |
|
||||||
|
|
||||||
end |
|
||||||
]]></lang:inline-script> |
|
||||||
<lang:property name="message" value="Hello World!"/> |
|
||||||
</lang:jruby> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,12 +0,0 @@ |
|||||||
<?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.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/Broken.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.Messenger"/> |
|
||||||
</bean> |
|
||||||
</beans> |
|
||||||
@ -1,36 +0,0 @@ |
|||||||
<?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.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg> |
|
||||||
<value>inline: |
|
||||||
require 'java' |
|
||||||
|
|
||||||
class RubyCalculator |
|
||||||
include org.springframework.scripting.Calculator |
|
||||||
|
|
||||||
def add(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
end |
|
||||||
</value> |
|
||||||
</constructor-arg> |
|
||||||
<constructor-arg value="org.springframework.scripting.Calculator"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="messenger" class="org.springframework.scripting.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/Messenger.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.Messenger"/> |
|
||||||
<property name="message" value="Hello World!"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="printer" class="org.springframework.scripting.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/Printer.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.jruby.Printer"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,53 +0,0 @@ |
|||||||
<?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="adder" class="org.springframework.scripting.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg> |
|
||||||
<value><![CDATA[inline: |
|
||||||
require 'java' |
|
||||||
|
|
||||||
class RubyPrimitiveAdder |
|
||||||
include org.springframework.scripting.jruby.PrimitiveAdder |
|
||||||
|
|
||||||
def addInts(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def addShorts(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def addLongs(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def addFloats(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def addDoubles(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def resultIsPositive(x, y) |
|
||||||
(x + y) > 0 |
|
||||||
end |
|
||||||
|
|
||||||
def concatenate(c, d) |
|
||||||
return ("" << c) << d; |
|
||||||
end |
|
||||||
|
|
||||||
def echo(c) |
|
||||||
c |
|
||||||
end |
|
||||||
|
|
||||||
end |
|
||||||
]]></value> |
|
||||||
</constructor-arg> |
|
||||||
<constructor-arg value="org.springframework.scripting.jruby.PrimitiveAdder"/> |
|
||||||
</bean> |
|
||||||
</beans> |
|
||||||
@ -1,73 +0,0 @@ |
|||||||
<?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="adder" class="org.springframework.scripting.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg> |
|
||||||
<value><![CDATA[inline: |
|
||||||
require 'java' |
|
||||||
|
|
||||||
class RubyWrapperAdder |
|
||||||
include org.springframework.scripting.jruby.WrapperAdder |
|
||||||
|
|
||||||
def addInts(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def addShorts(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def addLongs(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def addFloats(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def addDoubles(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
|
|
||||||
def resultIsPositive(x, y) |
|
||||||
(x + y) > 0 |
|
||||||
end |
|
||||||
|
|
||||||
def concatenate(c, d) |
|
||||||
return ("" << c) << d; |
|
||||||
end |
|
||||||
|
|
||||||
def echo(c) |
|
||||||
c |
|
||||||
end |
|
||||||
|
|
||||||
def concatArrayOfIntegerWrappers(numbers) |
|
||||||
buffer = "" |
|
||||||
numbers.each do |number| |
|
||||||
buffer << number.to_s |
|
||||||
end |
|
||||||
return buffer |
|
||||||
end |
|
||||||
|
|
||||||
def populate(x, y) |
|
||||||
[x, y] |
|
||||||
end |
|
||||||
|
|
||||||
def createListOfLists(x, y, z) |
|
||||||
[[x], [y], [z]] |
|
||||||
end |
|
||||||
|
|
||||||
def toMap(key, value) |
|
||||||
{key => value} |
|
||||||
end |
|
||||||
|
|
||||||
end |
|
||||||
]]></value> |
|
||||||
</constructor-arg> |
|
||||||
<constructor-arg value="org.springframework.scripting.jruby.WrapperAdder"/> |
|
||||||
</bean> |
|
||||||
</beans> |
|
||||||
@ -1,40 +0,0 @@ |
|||||||
<?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.support.StandardScriptFactory"> |
|
||||||
<constructor-arg value="jruby"/> |
|
||||||
<constructor-arg> |
|
||||||
<value>inline: |
|
||||||
require 'java' |
|
||||||
|
|
||||||
class RubyCalculator |
|
||||||
include org.springframework.scripting.Calculator |
|
||||||
|
|
||||||
def add(x, y) |
|
||||||
x + y |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
RubyCalculator.new |
|
||||||
</value> |
|
||||||
</constructor-arg> |
|
||||||
<constructor-arg value="org.springframework.scripting.Calculator"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="messenger" class="org.springframework.scripting.support.StandardScriptFactory"> |
|
||||||
<constructor-arg value="jruby"/> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/MessengerWithInstance.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.Messenger"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="printer" class="org.springframework.scripting.support.StandardScriptFactory"> |
|
||||||
<constructor-arg value="jruby"/> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/PrinterWithInstance.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.jruby.Printer"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
</beans> |
|
||||||
@ -1,21 +0,0 @@ |
|||||||
<?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"> |
|
||||||
<property name="defaultRefreshCheckDelay" value="1"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="calculator" class="org.springframework.scripting.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/Calculator.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.Calculator"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
<bean id="messenger" class="org.springframework.scripting.jruby.JRubyScriptFactory"> |
|
||||||
<constructor-arg value="classpath:org/springframework/scripting/jruby/Messenger.rb"/> |
|
||||||
<constructor-arg value="org.springframework.scripting.Messenger"/> |
|
||||||
<property name="message" value="Hello World!"/> |
|
||||||
</bean> |
|
||||||
|
|
||||||
</beans> |
|
||||||
Loading…
Reference in new issue