|
From: Cecil N. <cec...@gm...> - 2008-05-02 20:09:53
|
Hello- A question on resteasy and spring...
I have used resteasy to connect to my database as a test case by hard/soft
coding in a properties file. But to do it right I am trying to switch to a
connection pool. So I put together the applicationContext.xml file for
Spring, etc. It isn't working yet... I have tried various approaches, but
bottom line, it looks like spring is creating instances and so is resteasy.
So when resteasy tries to get my jdbc template instance, it is always null.
Based on the wiki article on this subject, I think the resteasy spring
version is supposed to inject *after* resteasy creates the instance. I
suspect there's more config info that I am missing. Hope someone can point
the way here.
Thanks
Here are some snippets in case it helps:
*from web.xml*
<web-app>
<!-- JSR 311 stuff -->
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<listener>
<listener-class>org.resteasy.plugins.server.servlet.SpringContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
</web-app>
*from applicationContext.xml*
<bean id="plmwh"
class="org.springframework.jndi.JndiObjectFactoryBean"
lazy-init="true">
<property name="jndiName" value="plmwh"></property>
</bean>
<bean id="gxoJdbcTemplate" class="gxo.dao.GXOJDBCTemplate">
<constructor-arg value="true" />
<property name="dataSource" ref="plmwh" />
</bean>
<bean id="dbquery3_dao" class="dbquery3_dao" >
<property name="jdbcTemplate">
<ref bean="gxoJdbcTemplate" />
</property>
</bean>
|