I need to implement a successful message that is shown via json, for when my message is returning like this below;
Idonotknowhowtoimplementthismessage,Itrieditthatway;
@PostMappingpublicResponseEntity<Employee>criar(@Valid@RequestBodyEmployeeemployee,BindingResultresult,HttpServletResponseresponse,Modelmodel){model.addAttribute("mensagem", "Cadastro de Employee feita com sucesso");
Employee employeeSalva = employeeRepository.save(employee);
URI uri = ServletUriComponentsBuilder.fromCurrentRequestUri().path("/{codigo}")
.buildAndExpand(employeeSalva.getId()).toUri();
response.setHeader("Location", uri.toASCIIString());
return ResponseEntity.created(uri).body(employeeSalva);
}
I tried to use the addAttribute method, but I did not succeed, could anyone please help me in the code so I can implement a successful message?