If you are declaring your configs in a separate package, make sure you add component scan like this :
@SpringBootApplication
@ComponentScan("com.mycompany.MY_OTHER_PACKAGE.account.config")
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
You may also need to add @component annotation in the config class like so :
@Component
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.....