The API below accept a json string from client, and the map it into a Email object. How can I get request body (email
) as a raw String? (I want both raw-string and typed version of email
parameter)
PS: This question is NOT a duplicate of: How to access plain json body in Spring rest controller?
@PostMapping(value = "/mailsender")
public ResponseEntity<Void> sendMail(@RequestBody Email email) {
//...
return new ResponseEntity<>(HttpStatus.OK);
}