jfilter
jfilter copied to clipboard
response media type is being xml if it's not indicated
Describe the bug @DynamicFilter(ObjectIdFilter.class) @GetMapping(value = "/objects", produces = { MediaType.APPLICATION_JSON_VALUE}) public Page<Object> getObjecList();
this is fine but if I remove produces = { MediaType.APPLICATION_JSON_VALUE}
response is being xml instead of json.
What is the way of setting json defaul media type?
In spring boot App In AppConfig set the required default content types. @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer .favorParameter(false) .ignoreAcceptHeader(true) .defaultContentType( MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML, MediaType.TEXT_XML, MediaType.TEXT_MARKDOWN, MediaType.MULTIPART_FORM_DATA, MediaType.MULTIPART_MIXED, MediaType.APPLICATION_RSS_XML, MediaType.APPLICATION_OCTET_STREAM); }