title: Custom security is not working when extending the WebSecurityConfigurerAdapter class in different package
body: <p>I have extendend <code>WebSecurityConfigurerAdapter</code> in a different package other than the package containing class for <code>@SpringBootApplication</code>. Then it's not working its generating default username and password.</p>
  
  <p>And it's working fine when it's in the same package.</p>
  
  <pre><code>package com.example;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  
  
  @SpringBootApplication
  public class DemoApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(DemoApplication.class, args);
      }
  }
  </code></pre>
  
  <p>class extending <strong>WebSecurityConfigurerAdapter</strong> </p>
  
  <pre><code>package com.securitymodule;
  
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  @Configuration
  @EnableWebSecurity
  public class WebSecurity extends WebSecurityConfigurerAdapter {
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          // TODO Auto-generated method stub
          super.configure(http);
          http.antMatcher("/**").authorizeRequests().anyRequest().hasRole("USER").and().formLogin();
      }
  
  
      @Autowired
      public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
          auth
          .inMemoryAuthentication()
          .withUser("user").password("password").roles("USER");
      }
  
      @Override
      protected void configure(AuthenticationManagerBuilder auth) throws Exception {
          // TODO Auto-generated method stub
          super.configure(auth);
          auth.
          inMemoryAuthentication()
          .withUser("user").password("password").roles("USER");
      }
  
  
  }
  </code></pre>