title: Spring: Does a method name in @Configuration class have any role
body: <pre><code>@Configuration
  public class AppConfig implements WebMvcConfigurer {
  
      // ...
  
      @Bean
      public LocaleResolver localeResolver(){ // other names for this method didn't work
          SessionLocaleResolver slr = new SessionLocaleResolver();
          slr.setDefaultLocale(Locale.US);
          return slr;
      }
  
  }
  </code></pre>
  
  <p>Above is a part of my configuration class in a Spring MVC app.</p>
  
  <p>When first testing <code>SessionLocalResolver</code>, I had the method name as <code>localResolver</code> (note the missing E) which caused the following exception: <code>Cannot change HTTP accept header – use a different locale resolution strategy</code> </p>
  
  <p>My understanding, and obviously I was wrong, that the name of bean methods have no semantic value what so ever. But in this case, using any name other than <code>localeResolver</code> results in the above mentioned exceptions.</p>
  
  <p>So my question: what is the role of the bean method name in an @Configuration class ? and where is that mentioned in the Spring documentation ?</p>