Hi,
I'm new to GWT and I was trying to get a simple app that will use GWT+Spring+Maven. I was able to find a suitable example on the internet for GWT+Spring+Maven, that also work. THe issue is that when I'm trying to define new beans and inject them in the exsiting GWT ones, the DI doesn't work as expected. I am getting no errors though, just null values.
The example was taken from internet. I had to tweak it a little bit to work properly. To that app I was trying to add a BO layer and a DAO layer.
Any suggestions how could I register&inject those beans (myObjectDAO and myObjectBO) into "quoteService"? "quoteService" bean is registered and injected properly in "quoteController". I do have the setters properly in place for the properties in the bean class, otherwise spring would complained.
Thank you.
service-context.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "...">
<beans>
<bean id="quoteService" class="com.totsp.sample.client.QuoteServiceImpl">
<property name="myObjBO">
<ref bean="myObjectBO" />
</property>
</bean>
<bean id="salesproServicePlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="location">
<value>classpath:service-placeholder.properties</value>
</property>
</bean>
<bean id="myObjectDAO" class="com.totsp.sample.dao.MyObjectDAOImpl">
<!--
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
-->
</bean>
<bean id="myObjectBO" class="com.totsp.sample.bo.MyObjectBOImpl">
<property name="myObjectDAO">
<ref bean="myObjectDAO" />
</property>
</bean>
</beans>
spring-servlet.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="..."
xmlns:xsi="..."
xsi:schemaLocation="...">
<!-- The application context definition for the DispatcherServlet -->
<!-- Maps the request through to a concrete controller instance -->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/**/quote.rpc=quoteController
</value>
</property>
</bean>
<!-- GwtRpcController wraps our service in order to decode the incoming -->
<!-- request then delegates processing of the call to the POJO service -->
<!-- and then encodes the return value forwarding the response. -->
<bean id="quoteController" class="com.totsp.sample.client.GwtRpcController">
<property name="remoteService">
<ref bean="quoteService" />
</property>
</bean>
</beans>
web.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="..."
xmlns:xsi="..."
xsi:schemaLocation="...">
<display-name>Sample</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:service-context.xml,
classpath:spring-servlet.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!--
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
-->
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.rpc</url-pattern>
</servlet-mapping>
</web-app>