Reputation: 71
Hi i tried to get userDetailsService with InMemoryDao. But i can't get it, i tried @Autowired, @Inject (UserDetailsService, InMemoryDaoImpl, InMemoryManager...) but cant get this working.
Have public class Security extends WebSecurityConfigurerAdapter and public class GlobalSecurity extends GlobalAuthenticationConfigurerAdapter.
Tried with only WebSecurityConfigurerAdapter with all four @Enable... Can some help me to solve this, i need to use loadUserByUsername()?
Upvotes: 1
Views: 1864
Reputation: 15533
You can expose the userDetailsService
bean by overriding method userDetailsServiceBean()
in your configuration class which extends WebSecurityConfigurerAdapter
. The whole method will look like this:
@Bean(name = "myUserDetailsService")
@Override
public UserDetailsService userDetailsServiceBean() throws Exception {
return super.userDetailsServiceBean();
}
And then you can inject it for example with @Autowired.
Upvotes: 2