失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Spring Boot GET请求使用Date接收时间戳

Spring Boot GET请求使用Date接收时间戳

时间:2024-02-29 18:41:13

相关推荐

Spring Boot GET请求使用Date接收时间戳

@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)}}

如果觉得《Spring Boot GET请求使用Date接收时间戳》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。