我使用的是Spring mvc 3.2.3.RELEASE这是我的终点
@PostMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE, value = "getEmployees")
public ResponseEntity<?> getEmployeeInfo(@RequestBody EmployeeReqDTO employeeReqDTO)
Employee emp1 = new Employee();
emp1.setAge("23");
emp1.setName("Test");
Employee emp2 = new Employee();
emp2.setAge("222");
emp2.setName("Iran");
List<Employee> empList = new ArrayList<>();
empList.add(emp1);
empList.add(emp2);
return new ResponseEntity<>(empList, HttpStatus.OK);
}
我得到以下响应
[
{
"$type": "Employee",
"Name": "Test",
"Age": "23"
},
{
"$type": "Employee",
"Name": "Iran",
"Age": "222"
}
]
我不需要"强者"$类型"属性,如何删除它??
在两个位置都替换为ResponseEntity<List<Employee>>
。
发生这种事是因为春天不知道你想回来什么。