Hello Evgeny,
could you try with the following code and attached xml file taken both
from the or.restlet.test package (class SpringTestCase) :
public static void main(String[] args) {
// Load the Spring container
ClassPathResource resource = new ClassPathResource(
"org/restlet/test/SpringTestCase.xml");
BeanFactory factory = new XmlBeanFactory(resource);
// Start the Restlet component
Component component = (Component) factory.getBean("component");
try {
component.start();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
best regards,
Thierry Boileau
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="component"
class="org.restlet.ext.spring.SpringComponent">
<property name="server" ref="server" />
<property name="defaultTarget" ref="application" />
</bean>
<bean id="server" class="org.restlet.ext.spring.SpringServer">
<constructor-arg value="http" />
<constructor-arg value="8182" />
<property name="parameters">
<props>
<prop key="key1">value1</prop>
<prop key="key2">value2</prop>
</props>
</property>
</bean>
<bean id="application"
class="org.restlet.ext.spring.SpringApplication">
<constructor-arg ref="component" />
<property name="root">
<bean class="org.restlet.ext.spring.SpringRouter">
<constructor-arg ref="application" />
<property name="attachments">
<map>
<entry key="/users/{user}"
value="org.restlet.example.tutorial.UserResource" />
<entry key="/users/{user}/orders"
value="org.restlet.example.tutorial.OrdersResource" />
<entry key="/users/{user}/orders/{order}"
value="org.restlet.example.tutorial.OrderResource" />
</map>
</property>
</bean>
</property>
</bean>
</beans>