Skip to content
Advertisement

Tag: registration

Cannot invoke findByEmail because “this.userRepository” is null error

I keep receiving a Cannot invoke “com.***.repositories.UserRepository.findByEmail(String)” because “this.userRepository” is null error everytime I try to process my /register method. I can’t figure out why the code is coming across as null. Controller – Axios call – My UserRepository – Answer Simply add @Autowired to your related fields you want to get Autowired by spring. Change your code from to

Advertisement