I have extendend WebSecurityConfigurerAdapter in a different package other than the package containing class for @SpringBootApplication. Then it\'s
@SpringBootApplication is a short hand for @Configuration, @EnableAutoConfiguration, @ComponentScan. This makes Spring to do componentscan for the current packages and packages below this. So all classes in com.example and under com.example are scanned for bean creation while not any others above com.example like com.securitymodule
Hence either add @ComponentScan(basePackages = {"com.securitymodule"}) into your main class, or make the package of WebSecurityConfigurerAdapter as com.example.securitymodule