79497350

Date: 2025-03-10 08:05:58
Score: 1
Natty:
Report link

Try adding this in your code instead of using field level bean creation, use constructor based bean creation for the UserRepo in CustomerDetails class like mentioned by @M.Deinum

import lombok.RequiredArgsConstructor;

@Service("customuserdetails")
@RequiredArgsConstructor
public class CustomUserDetails implements UserDetailsService {

    private final UserRepo userrepo;
    private final PasswordEncoder bcrypt;
// rest of the code
}

and add the @Configuration annotation instead of @Component to SecurityBeans class

import org.springframework.context.annotation.Configuration;

@Configuration
public class Securitybeans {

    //rest of the code
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Configuration
  • User mentioned (0): @Component
  • Low reputation (1):
Posted by: Veeresh