title: Spring MVC LocaleChangeInterceptor annotation based doesn't work
body: <pre><code>import java.util.Locale;
  
  import org.springframework.context.MessageSource;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.support.ReloadableResourceBundleMessageSource;
  import org.springframework.web.servlet.HandlerMapping;
  import org.springframework.web.servlet.LocaleResolver;
  import org.springframework.web.servlet.i18n.CookieLocaleResolver;
  import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
  import org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping;
  
  @Configuration
  public class Config {
      @Bean
      public LocaleResolver localeResolver() {
          final CookieLocaleResolver ret = new CookieLocaleResolver();
          ret.setDefaultLocale(new Locale("en_US"));
          return ret;
      }
  
      @Bean
      public MessageSource messageSource() {
          final ReloadableResourceBundleMessageSource ret = new ReloadableResourceBundleMessageSource();
          ret.setBasename("classpath:lang");
          ret.setDefaultEncoding("UTF-8");
          return ret;
      }
  
      @Bean
      public HandlerMapping handlerMapping() {
          final LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor();
          interceptor.setParamName("language");
  
          final DefaultAnnotationHandlerMapping ret = new DefaultAnnotationHandlerMapping();
          ret.setInterceptors(new Object[] { interceptor });
          return ret;
      }
  }
  </code></pre>
  
  <p>The above is my annotation configuration. I've basically translated <a href="http://viralpatel.net/blogs/spring-3-mvc-internationalization-i18n-localization-tutorial-example/">this</a> tutorial's XML.</p>
  
  <p>Strangely it doesn't work when I go to <code>...?language=fr</code>.</p>
  
  <p>However, the following does work (in <code>app-servlet.xml</code>) (notice here it's using <code>locale</code>):</p>
  
  <pre><code>&lt;mvc:interceptors&gt;
      &lt;bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt;
          &lt;property name="paramName" value="locale" /&gt;
      &lt;/bean&gt;
  &lt;/mvc:interceptors&gt;
  </code></pre>
  
  <p>Another important thing to note is that when I put breakpoints on the above methods, all of the three of them, every breakpoint does break, which implies that "someone" is reading the values.</p>
  
  <p>So, why wouldn't my annotation based interceptor doesn't work?</p>