title: GWT + Spring + No bean named 'dispatch' is defined
body: <p>while trying to use spring dependency injection instead of <strong>guice</strong>, getting below error </p>
  
  <p>No bean named <strong>'dispatch'</strong> is defined</p>
  
  <pre><code>[WARN] /dispatch/
  org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dispatch' is defined
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1083)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:274)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1079)
      at org.springframework.web.context.support.HttpRequestHandlerServlet.init(HttpRequestHandlerServlet.java:57)
      at javax.servlet.GenericServlet.init(GenericServlet.java:212)
      at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)
      at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:342)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
  </code></pre>
  
  <p>Could you please help on this.</p>
  
  <h2>web.xml content is as below</h2>
  
  <pre><code>&lt;context-param&gt;
  &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
  &lt;param-value&gt;classpath*:META-INF/applicationContext.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  
  
  &lt;listener&gt;
  &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  
  &lt;servlet&gt;
  &lt;servlet-name&gt;dispatch&lt;/servlet-name&gt;
  &lt;servlet-class&gt;org.springframework.web.context.support.HttpRequestHandlerServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
  &lt;servlet-name&gt;dispatch&lt;/servlet-name&gt;
  &lt;url-pattern&gt;/dispatch/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <hr>
  
  <p>And SeverModule class is </p>
  
  <pre><code>package com.khush.util.server.spring;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.annotation.Import;
  
  import com.gwtplatform.dispatch.server.actionvalidator.ActionValidator;
  import com.gwtplatform.dispatch.server.spring.HandlerModule;
  import com.gwtplatform.dispatch.server.spring.actionvalidator.DefaultActionValidator;
  import com.gwtplatform.dispatch.server.spring.configuration.DefaultModule;
  import com.khush.util.shared.action.RetrieveAccountsAction;
  
  @Configuration
  @Import(DefaultModule.class)
  public class ServerModule extends HandlerModule {
  
    public ServerModule() {
    }
  
    @Bean
    public RetrieveAccountsHandler getRetrieveAccountsHandler() {
      return new RetrieveAccountsHandler();
    }
  
    @Bean
    public ActionValidator getDefaultActionValidator() {
      return new DefaultActionValidator();
    }
  
    protected void configureHandlers() {
        bindHandler(RetrieveAccountsAction.class, RetrieveAccountsHandler.class);
    }
  }
  </code></pre>
  
  <p>Regards.</p>