Spring rest controller return xml instead of json. It enables us to Define endpoints for d...
Spring rest controller return xml instead of json. It enables us to Define endpoints for different HTTP methods (GET, POST, PUT, DELETE), return data in various formats (JSON, XML, etc. I would either define the produces attribute in your mappings or configure a WebMvcConfigurer to set json as the default type. Jul 23, 2025 · When we create a Spring Boot project with Starter Web dependency, we only get support for returning data in JSON format, with the help of the Jackson library. Mar 1, 2021 · It might be, because Spring Boot picks up the xml-parsing lib through dependency B. Ideally any call to this Controller would always get XML, regardless of header being present). Nov 19, 2014 · RequestMapping annotation doesn't work on the repositoryies. 6. Library for OpenAPI 3 with spring boot projects. 0 all my RestControllers returns now XML instead of JSON Where can I change this, without. Dec 25, 2025 · This behavior can be confusing, especially if you intended to support both JSON and XML but want JSON as the default.