title: Spring MVC no default constructor found?
body: <p>I'm having problems with my Spring controllers - I'm getting no default constructor found - but they do have a constructor which I am trying to created via the applicationContext.xml - heres the relevant bit:</p>
  
  <pre><code>&lt;bean id="PcrfSimulator" class="com.rory.services.pcrf.simulator.PcrfSimulator" init-method="start"&gt;  
  &lt;/bean&gt;
  
  &lt;bean id="CacheHandler" class="com.rory.services.pcrf.simulator.handlers.CacheHandler"&gt;
      &lt;constructor-arg index="0" type="com.rory.services.pcrf.simulator.CustomGxSessionIdCacheImpl"&gt;
          &lt;bean factory-bean="PcrfSimulator" factory-method="getGxSessionIdCache"&gt;
          &lt;/bean&gt;
      &lt;/constructor-arg&gt;       
  &lt;/bean&gt;
  </code></pre>
  
  <p>Ie. I'm creating a bean first, and then trying to pass the result of a method call from that bean into the second bean's (CacheHandler) constructor. </p>
  
  <p>Here'e the start of CacheHandler:</p>
  
  <pre><code>    @Controller
      public class CacheHandler {
  
      private final CustomGxSessionIdCacheImpl gxSessionIdCache;
  
      public CacheHandler(CustomGxSessionIdCacheImpl gxSessionIdCache) {
          this.gxSessionIdCache = gxSessionIdCache;
      }
  </code></pre>
  
  <p>Here's the error I'm getting:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheHandler' defined in URL [jar:file:/users/rtorney/Documents/apache-tomcat-7.0.25/webapps/PCRFSimulator-4.0/WEB-INF/lib/PCRFSimulator-4.0.jar!/com/rory/services/pcrf/simulator/handlers/CacheHandler.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.rory.services.pcrf.simulator.handlers.CacheHandler]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.rory.services.pcrf.simulator.handlers.CacheHandler.&lt;init&gt;()
  </code></pre>
  
  <p>Any help is much appreciated!</p>