Question :
The controller class annotated with @RestController expects the returned data format to be JSON, but the actual return is indeed in XML format. As shown below:
Scenario :
It was normal at the beginning of the creation of the Spring Boot project, but after the introduction of the Spring Cloud-related dependency package spring-cloud-starter-netflix-eureka-server, this problem occurred.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>3.0.5</version>
</dependency>
Reason and analysis :
The controller class annotated with @RestController returns the response body annotated with @ResponseBody. The default format is JSON, but it can also be in other formats, such as XML.
Spring Boot uses jackson to process data in JSON format by default, but if jac is introduced in the project