<?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.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>