Hi Evgeny,

Here is the sample XML that we use for unit testing. It should work as you
want:

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

Best regards,
Jerome  

> -----Message d'origine-----
> De : news [mailto:[EMAIL PROTECTED] De la part de Evgeny Shepelyuk
> Envoyé : mercredi 26 décembre 2007 11:08
> À : [email protected]
> Objet : Re: Restlet 1.1m1 + Spring = circular dependency ?
> 
>       Hello Thierry!
> 
> Thnx for answer. But unfortunately it's not the solution i'm 
> looking for  
> :))
> My problem is not impossiblity to start restlet based service 
> with spring.
> My problem is that i can't start restlet services _in the way i want_.
> 
> The way i'm trying to accomplish is make Spring start all my 
> applications  
> components (including restlet) only using XML configuration.
> Without writing _any_ glue code in main() method.
> The final objective is make main() method of my application 
> look exactly  
> like this :)))
> 
> public static void main(String[] args) {
>       ClassPathXmlApplicationContext ctx = new  
> ClassPathXmlApplicationContext("META-INF/spring.xml");
>       ctx.registerShutdownHook();
> }
> 
> Is there any way to achieve this goal in current 
> implementation of Restlet  
> ?
> Thnx in advance !
> 
> > 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
> 
> 
> 
> -- 
> Best Regards
> Evgeny K. Shepelyuk

Reply via email to