Having to use deprecated classes with Spring MVC
<p>Have been trial Spring Web MVC (4.2.5) and have his a number of issues trying to use a DispatcherServlet and</p>

<pre><code>&lt;mvc:annotation-driven /&gt; 
</code></pre>

<p>Have setup a simple @Controller class and wanted to use the POJO to JSON mapping.  The docu said that if Jackson was detected on the class path it would be used automatically, however this didn't work for me and I was forced to use the 'deprecated' AnnotationMethodHandlerAdapter</p>

<pre><code>&lt;bean name="mappingJackson2HttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" /&gt;

&lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" &gt;
  &lt;property name="messageConverters" ref="mappingJackson2HttpMessageConverter"/&gt;
&lt;/bean&gt;
</code></pre>

<p>which then worked fine.</p>

<p>Equally, tried to create a @ControllerAdvice class for handling all exceptions, but only got an @ExceptionHandler method working on the same controller class, and that was only when I added the (again) deprecated AnnotationMethodHandlerExceptionResolver to the context.</p>

<pre><code>&lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver" /&gt;
</code></pre>

<p>Having to instantiate two deprecated classes suggests I am doing something wrong, especially when all the tutorials seem to suggest this should all 'just work', but I cannot see what (and indeed nosing through the Spring source I cannot see how the default and recommended handlers would work anyway)</p>

<p>There are no errors, the annotation simply aren't detected.  The fill context xml is</p>

<p>please find the entire context XML below (is very simple)</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd"&gt;

&lt;mvc:annotation-driven enable-matrix-variables="true"/&gt;

&lt;bean name="mappingJackson2HttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" /&gt;

&lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" &gt;
    &lt;property name="messageConverters" ref="mappingJackson2HttpMessageConverter"/&gt;
&lt;/bean&gt;

&lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver" /&gt;

&lt;context:component-scan base-package="com.domain.datastore.dao"/&gt;

&lt;context:component-scan base-package="com.domain.service"/&gt;

&lt;context:component-scan base-package="com.domain.uiapi"/&gt;

&lt;/beans&gt;
</code></pre>

<p>An example controller is </p>

<pre><code>@RestController("/place/*")
public class PlaceController {

private PlaceService placeService;

@Autowired
public PlaceController(PlaceService placeService) {
    this.placeService = placeService;
}

@RequestMapping(path="/{id}", method = RequestMethod.GET)
public @ResponseBody Place getPlace(@PathVariable("id") long id, Model model)   {
    return placeService.getPlace(id);
}


}
</code></pre>

<p>and the cross-cutting exception handler is</p>

<pre><code>@ControllerAdvice
public class GlobalExceptionController {

public GlobalExceptionController() {
    System.out.println("GlobalExceptionController");
}

@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(NotFoundException.class)
public ModelAndView handleCustomException(NotFoundException ex) {
    return  null;
}
}
</code></pre>