Deserialization of json wrong date object on java server

2

I have a user object and it contains the datadate attribute, I pass the user object to the server, the date I provide in the following format 2017-12-31, but the server changes to 2017-12-30, it always decrements a day on date

server

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/")
public Response store(Usuario usuario) {
    try {
        if(dao(this).existeEmail(usuario.getEmail())) {
            return erro("Email já existe!");
        }

        dao(this).save(usuario);

        return responseOk(usuario);

    }catch (Exception e) {
        return erroInterno(e);
    }
}

User Template

@Entity
class Usuario {
    @Temporal(TemporalType.DATE)
    private Date dataDeNascimento;
 }
    
asked by anonymous 03.10.2017 / 03:42

0 answers