Reputation: 3715
Spring Boot with Web dependency pulls jackson
library dependencies and supports the Json format out of the box. But when I try to fetch the data in the xml format by placing the Accept header to application/xml
, I get 406. The issue is resolved by adding the jackson-dataformat-xml
dependency.
My question are,
Upvotes: 0
Views: 388
Reputation: 5142
Spring is opinionated in many ways, and only supporting JSON out of the box is one example of that. Not all developers will want XML support and so it is left as an optional dependency.
JAXB was pulled from the normal JDK distribution in Java 9 in order to help make the core JDK less bloated. Again, the idea is to let developers opt in to the technologies they need instead of giving them everything by default.
Here's a little history of JAXB and the various Java versions: https://www.jesperdj.com/2018/09/30/jaxb-on-java-9-10-11-and-beyond/
Upvotes: 1