@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService((UserDetailsService) userService).passwordEncoder(passwordEncoder()); }