No primary or single unique constructor found for interface UserDetails

51 Views Asked by At

can't understand and find something useful to solve this issue. I'm trying to test controller method with UserService as argument, this is controller method, this is test method

I'm trying @WithMockUserDetails and autowiring userDetailsService and use it inside mockMVC.perform(get("/cart").with(user(userDetailsService.loadUserByUsername("[email protected]"))). sql request is working but exception is thrown anyway: jakarta.servlet.ServletException: Request processing failed: java.lang.IllegalStateException: No primary or single unique constructor found for interface org.springframework.security.core.userdetails.UserDetails

0

There are 0 best solutions below