I want to move my Spring-Boot project from JDK 8 to 11.
Controller :
@RequestMapping(value = "/{model}/columns", method = RequestMethod.GET, consumes = MediaType.ALL_VALUE, produces = { MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<DataModel> getColumnsModel(@PathVariable String model) {
LOGGER.info("getColumnsModel : model[{}]", model);
DataModel dataModel = modelService.getColumns(model);
return Optional.ofNullable(dataModel).map(result -> new ResponseEntity<>(result, HttpStatus.OK)).orElse(new ResponseEntity<>(HttpStatus.NO_CONTENT));
}
My JSON curl (OK in JDK 8 and JDK 11):
curl -s --header "Accept: application/json" http://localhost:8084/noraui/api/hello/columns > target/actual_hello_columns.json
My XML curl (OK in JDK 8 but not OK in JDK 11):
curl -s --header "Accept: application/xml" http://localhost:8084/noraui/api/hello/columns > target/actual_hello_columns.xml
In JDK 11, the result is coming empty.
How to resolve this (I need use my code on JDK8 and JDK11)?
EDIT:
I have this error:
Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]