@GetMapping("/get")
public String get(Studert student){
return 'student';
}
public class Studert {
private Date birthday;
}
请求:localhost:8080/get?birthday=1611647725682
结果:springboot会将birthday当作String处理,然后报错。
解决方法: 对应属性的set方法中做转换处理。
public class Studert {
private Date birthday;
public setBirthDay(String birthday) {
this.birthday = new Day(Long.parseLong(birthday)
}
}