I got this error when using Spring 2.7.4: No primary or unique constructor found for class com.library.project.library_el_aleph.model.Client I have two constructors for two possible inserts in my POJO Entity classes
 @Repository
 public interface RoleRespository extends CrudRepository<Role, Integer>{
     Role findByUserName(RoleList roleName);
public Cliente(@NotEmpty @Pattern(regexp = "^[A-Z][a-zA-Z]+") String userName, 
@NotEmpty String email,
    @NotEmpty String contraseña) {
    this.userName = userName;
    this.email = email;
    this.contraseña = contraseña;
}
public Cliente(String productosCliente,
    @NotEmpty @Pattern(regexp = "^[A-Z][a-zA-Z]+") String userName, @NotEmpty String segundoNombre,
    @NotEmpty String primerApellido, @NotEmpty String segundoApellido, @NotEmpty String ciudadCliente,
    @NotEmpty String direccionCliente, @NotEmpty String email, @NotEmpty String contraseña,
    @NotNull @Past Date fechaNacimiento, @NotNull Set<Role> roles) {
    
    this.productosCliente = productosCliente;
    this.userName = userName;
    this.segundoNombre = segundoNombre;
    this.primerApellido = primerApellido;
    this.segundoApellido = segundoApellido;
    this.ciudadCliente = ciudadCliente;
    this.direccionCliente = direccionCliente;
    this.email = email;
    this.contraseña = contraseña;
    this.fechaNacimiento = fechaNacimiento;
    this.roles = roles;
}
}
This is part of the code of my RESTController with the method that sets the @RequesBody inputs:
@RequestMapping(value= "/register", method = RequestMethod.POST)
public ResponseEntity<Object> register(@Valid @RequestBody NewUser newUser, 
BindingResult send){
    
    if(send.hasErrors())
        return new ResponseEntity<>(new Message("Error en el registro, por favor 
    valide nuevamente"), HttpStatus.BAD_REQUEST);
    try {
        Cliente creatingUser = new Cliente(newUser.getPrimerNombre(), 
        newUser.getEmail(), passwordEncoder.encode(newUser.getPassword()));
        Set<Role> roles = new HashSet<>();
        roles.add(roleServices.getRoleByName(RoleList.ROLE_USER).get());
        if(newUser.getRoles().contains("Admin"))
            roles.add(roleServices.getRoleByName(RoleList.ROLE_ADMIN).get());
        creatingUser.setRoles(roles);
        clienteServices.saveNewUser(creatingUser);
        return new ResponseEntity<>(new Message("El usuario ha sido creado correctamente"), HttpStatus.OK);
    } catch (Exception e) {
        return new ResponseEntity<Object>(new Message("Ha ocurrido un error inesperado con el servidor, por favor intente nuevamente más tarde"), HttpStatus.BAD_REQUEST);
        
    }  
} 
It is the first time that I use more than one constructor for the same class and I think that is why the error is due... Can anybody help me?
 
    