title: How to enable Spring 3.0 MappingJacksonHttpMessageConverter with @ResponseBody AND pre-Spring-3.0 Controller SimpleUrlHandlerMapping together?
body: <p>As the title suggests, I'm trying and failing to get the following combination working in Spring 3.0:</p>
  
  <ul>
  <li>pre-Spring-3.0 controllers mapped with SimpleUrlHandlerMapping, and,</li>
  <li>a Spring-3.0 @Controller using MappingJacksonHttpMessageConverter and @ResponseBody to return JSON.</li>
  </ul>
  
  <p>All the pieces work - except when put together!</p>
  
  <p>In more detail, I have an existing Spring web-app which includes many pre-Spring-3.0 controllers.  These implement Controller and are mapped explicitly with a SimpleUrlHandlerMapping bean.  (So one solution is to change them all to @Controller style).  The same web-app (DispatcherServlet) also supports several newer controllers annotated with @Controller.</p>
  
  <p>My bean config includes the following, and all is good:</p>
  
  <pre><code>&lt;bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&gt;
      &lt;property name="mappings"&gt;
          &lt;props&gt;
              &lt;prop key="/path/name.ext"&gt;mySpring25Controller&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Now I'm adding, to a new controller annotated with @Controller and @RequestMapping, use of MappingJacksonHttpMessageConverter so that with @ResponseBody some of my methods can return JSON via Jackson - to Ajax calls.  Again all is good:</p>
  
  <pre><code>&lt;!-- to generate JSON responses using Jackson (without using &lt;mvc:annotation-driven/&gt;) --&gt;  
  &lt;bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /&gt;
  
  &lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
      &lt;property name="messageConverters"&gt;
        &lt;list&gt;
          &lt;ref bean="jacksonMessageConverter"/&gt;
        &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;     
  </code></pre>
  
  <p>The problem is that now my explicit mappings defined in the SimpleUrlHandlerMapping bean are no longer working:</p>
  
  <pre><code>[http-8081-Processor25] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mayapp].[springapp]  - Servlet.service() for servlet springapp threw exception
  javax.servlet.ServletException: No adapter for handler [com.mycom.controller.mySpring25Controller ...]: Does your handler implement a supported interface like Controller?
      at org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:985)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:773)
  </code></pre>
  
  <p>These mappings still appear in my log at start-up (SimpleUrlHandlerMapping  - Mapped URL path ... etc) - but evidently are now broken somehow.</p>
  
  <pre><code>INFO org.springframework.web.servlet.handler.SimpleUrlHandlerMapping  - Mapped URL path [/path/name.ext] onto handler [com.mycom.controller.mySpring25Controller ....]
  </code></pre>
  
  <p>I started with <code>&lt;mvc:annotation-driven/&gt;</code> which had the same problem.  I've tried re-ordering without success, including order properties.  And I've also not found an explanation in the Spring docs.  It seems there is some interaction in the Spring auto-magic which I haven't got to the bottom of.</p>
  
  <p>Interesting problem anyone?  Insight gratefully received!</p>