After adding spring-security module to my Spring app, when I use postman to post a request with Authorization option is No Auth and header Accept is */*, the Spring app returns a xml body like:
<Map>
<timestamp>1563355321349</timestamp>
<status>401</status>
<error>Unauthorized</error>
<message>Unauthorized</message>
<path>/odm/test</path>
</Map>
It returns xml when Unauthorize but when the request is successfully authenticated, the body is in json.
I want the Unauthorize response body to be in json instead of xml. I tried to remove MappingJackson2XmlHttpMessageConverter from HttpMessageConverters list and it works but I want to keep it in list of course. Does Spring prioritize xml over json when Accept header is */* ?
Anyway to set Gson as default http message converter instead of Jackson in Spring boot 2.0 ?