前端:Required List parameter ‘list’ is not present
后端代码:
package cn.itcast.controller;
import cn.itcast.pojo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class StudentController {
@PostMapping("/students")
public Student getStudent(@RequestBody List studentList){
return studentList.get(0);
}
}