I want to implement Spring endpoint in which I can return XML object NotificationEchoResponse and http status code. I tried this:
@PostMapping(value = "/v1/notification", produces = "application/xml")
public ResponseEntity<?> handleNotifications(@RequestParam MultiValueMap<String, Object> keyValuePairs) {
if (!tnx_sirnature.equals(signature))
{
return new ResponseEntity<>("Please contact technical support!", HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(new NotificationEchoResponse(unique_id), HttpStatus.OK);
}
But I get error: Cannot infer type arguments for ResponseEntity<> at this line: return new ResponseEntity<>("Please contact technical support!", HttpStatus.INTERNAL_SERVER_ERROR); Do you know know how I can fix this issue?