Hi, As there doesn't seem to be a good example of how to configure Spring, a servlet container (tested with tomcat 5.5) and Restlet using properly injected beans rather than the RestManager hack. I thought I'd post how I did it.
I used a SpringServerServlet given to me by Florian Schwarz see: http://article.gmane.org/gmane.comp.java.restlet/3963 - Thanks Florian! can this or similar be added to SVN? Then configured the beans in my application context as below. In order to work it requires the fixed version of org.restlet.Connector see: http://article.gmane.org/gmane.comp.java.restlet/3818 (doesn't appear to be in Maven Repository yet) This approach could easily be extended to use SpringResources etc. Not sure if this is a good approach but if I'd have seen this a few days ago it would have helped me greatly! Config files below. Regards, Barry My web.xml then looks like this: <?xml version="1.0"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>LoginRestfulService</display-name> <description>Login Restful Service</description> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value> WEB-INF/classes/applicationContext.xml </param-value> </context-param> <!-- The Restlet-Application Spring bean that will used by the Restlet SpringServerServlet. --> <context-param> <param-name>org.restlet.application</param-name> <param-value>application</param-value> </context-param> <!-- The Restlet-Component Spring bean that will used by the Restlet SpringServerServlet. --> <context-param> <param-name>org.restlet.component</param-name> <param-value>component</param-value> </context-param> <!-- Restlet adapter --> <servlet> <servlet-name>loginRestlet</servlet-name> <servlet-class> com.blah.restful.core.SpringServerServlet </servlet-class> </servlet> <!-- Mapping to the Restlet stuff --> <servlet-mapping> <servlet-name>loginRestlet</servlet-name> <url-pattern>/api/*</url-pattern> </servlet-mapping> </web-app> **************************************** My applicationContext.xml then looks like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//Spring//DTD Bean//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- Context is set by the SpringServerServlet --> <bean id="application" class="org.restlet.Application"> <property name="root" ref="springRouter" /> </bean> <bean id="component" class="org.restlet.ext.spring.SpringComponent"> </bean> <bean id="springRouter" class="org.restlet.ext.spring.SpringRouter"> <constructor-arg ref="application" /> <property name="attachments"> <map> <entry key="/users/{user}" value-ref="userRestlet" /> </map> </property> </bean> <!-- A custom restlet that extends restlet and expects an injected user service--> <bean id="userRestlet" class="com.blah.restlet.UserRestlet"> <property name="userService" ref="userServiceImpl" />> </bean> <bean id="userServiceImpl" class="org.blah.UserServiceImpl"> </bean> </beans>

