@Service("customuserdetails")
public class CustomUserDetails implements UserDetailsService {
@Autowired
private UserRepo userrepo;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
Supplier<UsernameNotFoundException> s= () -> new UsernameNotFoundException("Error finding the user");
User user=userrepo.findByUsername(username).orElseThrow(s);
return user;
}}
This is the implementation which is working. I had to change my security beans to @configuration, and I added @repository to my repo interfaces. I also ended up changing my User class to implement UserDetails.