Springboot error while returning JSON

Asked

Viewed 87 times

0

I am using Spring Boot on my API. Spring has the ability to convert Javabeans automatically to Jsons when returning an object.

However, with this code (in my MODEL layer) I am having a Classcastexception.

public InfosUserLogado listaUsuarioLogado(TokenApp tokenApp) {
    ResponseEntity<InfosUserLogado> responseEntity = requester.doRequest(tokenApp, Constants.USER_AUTHENTICATED_URL, HttpMethod.GET, null);
    return responseEntity.getBody();
}

java.lang.Classcastexception: java.lang.String cannot be cast to me.package.toolsapi.model.users.pojo.Infosuserloaded

  • Check if your method or controller has the annotation @ResponseBody

  • It has the annotation, yes.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.