Spring Boot - Request and Response HandlingWhy might Spring Boot ignore the Accept header and always return JSON even if the client requests XML?ANo XML message converter is configured in the applicationBThe controller method uses consumes instead of producesCThe Accept header is misspelled in the client requestDSpring Boot does not support XML responses by designCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand role of message convertersSpring Boot uses message converters to convert objects to requested formats like JSON or XML.Step 2: Identify missing XML converter effectIf no XML converter is present, Spring Boot cannot produce XML and defaults to JSON.Final Answer:No XML message converter is configured in the application -> Option AQuick Check:Missing converter causes fallback to JSON [OK]Quick Trick: Add XML converter to support XML responses [OK]Common Mistakes:Assuming Spring Boot lacks XML supportConfusing consumes with producesIgnoring message converter configuration
Master "Request and Response Handling" in Spring Boot9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Spring Boot Quizzes Application Configuration - application.properties structure - Quiz 2easy Inversion of Control and Dependency Injection - Field injection and why to avoid it - Quiz 12easy Logging - Logger creation in classes - Quiz 13medium REST Controllers - @PutMapping and @DeleteMapping - Quiz 15hard REST Controllers - @RequestBody for JSON input - Quiz 11easy Request and Response Handling - Returning different status codes - Quiz 5medium Spring Annotations - @Profile for environment-specific beans - Quiz 2easy Spring Annotations - @Configuration and @Bean - Quiz 4medium Spring Boot Fundamentals - Why Spring Boot over plain Spring - Quiz 10hard Spring Boot Fundamentals - Embedded server concept - Quiz 7medium