title: Can not understand difference in behavior between : @EnableWebMvc and <annotation-driven />
body: <p>I was looking for annotation based approach for <code>&lt;interceptors&gt;</code> and then found the way <a href="http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-config-interceptors" rel="nofollow">here</a></p>
  
  <p>So I used it and its working, but there is a catch.</p>
  
  <p>When I do;</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  public class WebApplicationConfig extends WebMvcConfigurerAdapter{
       ....
  }
  </code></pre>
  
  <p>and there is no <code>&lt;annotation-driven /&gt;</code> tag in servlet-context.xml then it works perfectly fine and url are intercepted and corressponding pre-post logic works as implemented in "WebApplicationConfig " -  my custom interceptor.</p>
  
  <p>But if I remove <code>@EnableWebMvc</code> and add <code>&lt;annotation-driven /&gt;</code> then logically speaking application does not work, meaning no url's are intercepted its like "WebApplicationConfig " class is not even there.</p>
  
  <p>and off cource if I keep both <code>@EnableWebMvc</code> and <code>&lt;annotation-driven /&gt;</code> then I get exception while deploying the application. :</p>
  
  <pre><code>    ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed
      ..........
      Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.web.servlet.HandlerExceptionResolver 
  
  org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.handlerExceptionResolver()] threw exception;
  
   nested exception is java.lang.ClassCastException:
  
   org.springframework.web.accept.ContentNegotiationManagerFactoryBean$$EnhancerByCGLIB$$56a95502 cannot be cast to org.springframework.web.accept.ContentNegotiationManager
  </code></pre>
  
  <p>So why url's are not intercepted , when I used <code>&lt;annotation-driven /&gt;</code> instead of <code>@EnableWebMvc</code></p>
  
  <p>Also if I go with <code>@EnableWebMvc</code> and no <code>&lt;annotation-driven /&gt;</code>, then using  <code>@EnableWebMvc</code> at place of declaring class WebApplicationConfig is right place?</p>