Here is my scenario. I am trying to inject some service in my ServerResource
class and its just not injecting the service.
The steps I have performed are as follows.

<util:map id="resourceMap">
<entry key="/request">
<bean id="configurationFinder" class="org.restlet.ext.spring.SpringFinder">
<lookup-method name="createResource" bean="requestResouce"/>
</bean>
</entry>
</util:map>

<bean id="requestResouce" class="com.thoughtclicks.requestResource"
scope="prototype">
<property name="service" ref="serviceBean" />
</bean>

Where serviceBean is already defined in the config file. also Resource class
is a simple Class extending ServerResource and having a property called
"service" with a public getter and setter of the property.

My application class is simple extending the Application class from
org.restlet.Application with the following code :

@Override
public Restlet createRoot() {
Router router = new Router(getContext());

SpringContext springContext = new SpringContext(getContext());
XmlBeanDefinitionReader xmlReader = new
XmlBeanDefinitionReader(springContext);
xmlReader.loadBeanDefinitions(new
ClassPathResource("resource/appContext.xml"));
springContext.refresh();
Map<String, Finder> resourceMap = (Map<String, Finder>)
springContext.getBean("resourceMap");
for (String key : resourceMap.keySet())
{
router.attach(key, resourceMap.get(key));
    }
return router;

}

Not sure what is wrong as my service is returning null for some reason and
when i see the logs i don;t see my injection methods being called.

Any clues or pointers to this is highly appreciated.

Thanks,
Rahul

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2394134

Reply via email to