title: Is it possible to wire a Spring MVC Interceptor using annotations?
body: <p>Is it possible to wire a Spring MVC Interceptor using annotations and if so could someone provide me with an example of how to do so?</p>
  
  <p>By wire via annotation I am referring to doing as little in the XML configuration as possible. For example in this configuration file I found at <a href="http://www.vaannila.com/spring/spring-interceptors.html" rel="noreferrer">http://www.vaannila.com/spring/spring-interceptors.html</a>;</p>
  
  <pre><code>&lt;bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" p:interceptors-ref="loggerInterceptor" /&gt;
  &lt;bean id="loggerInterceptor" class="com.vaannila.interceptor.LoggerInterceptor" /&gt;
  </code></pre>
  
  <p>How little configuration could you get away with there? I imagine an <code>@Autowired</code> would remove the need to explicitly declare the bean in line 2, but would it be possible to get rid of line 1 with an annotation as well?</p>