Cannot get UserDetailsManager injected with Spring Boot and Java-based Configuration
问题 I have spring boot webapp that uses the Java-based configuration to configure a JdbcUserDetailsManager: @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired protected DataSource dataSource; @Autowired public void configAuthentication(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication() .dataSource(dataSource) .usersByUsernameQuery("select username as principal, password as credentials, true from users