title: Difference between registerGlobal(), configure(), configureGlobal(),configureGlobalSecurity in Spring security
body: <p>I have below three code snippets all doing the same thing: creating in-memory authentication. So how it impacts defining it in different method names?</p>
  
  <ol>
  <li>registerGlobal</li>
  <li>configure</li>
  <li>configureGlobal</li>
  <li>configureGlobalSecurity</li>
  </ol>
  
  <p>First one:</p>
  
  <pre><code>public void registerGlobal(AuthenticationManagerBuilder auth) throws Exception {
      auth
        .inMemoryAuthentication()
          .withUser("user").password("password").roles("USER").and()
          .withUser("admin").password("password").roles("USER","ADMIN");
      }
  }
  </code></pre>
  
  <p>Second one:</p>
  
  <pre><code>@Override
  protected void configure(AuthenticationManagerBuilder auth) throws Exception {
      auth
           .inMemoryAuthentication()
                .withUser("user").password("password").roles("USER");
   }
  </code></pre>
  
  <p>Third one:</p>
  
  <pre><code>public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
      auth
           .inMemoryAuthentication()
                .withUser("user").password("password").roles("USER");
  }
  </code></pre>
  
  <p>Fourth:</p>
  
  <pre><code>@Autowired
  public void configureGlobalSecurity(AuthenticationManagerBuilder auth)     throws Exception {
      auth.inMemoryAuthentication().withUser("user").password("user").roles("USER");
  }
  </code></pre>
  
  <p><strong>UPDATE 1 :</strong>
  One more thing I would like to add:</p>
  
  <p>configure() method is present in WebSecurityConfigurerAdapter class while others are not present.</p>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>I renamed the method in my sample project to below and to my surprise it is working and authenticating the users.</p>
  
  <p><strong>you name it anything and it works</strong></p>
  
  <pre><code>@Autowired
  public void anyMethodName(AuthenticationManagerBuilder auth) throws Exception {
              auth.inMemoryAuthentication().withUser("user").password("user").roles("USER");      
  }
  </code></pre>