活泼的甜薯

导航

Cannot construct instance of `xxxxxxx` (no Creators, like default construct, exist)的解决方法

用SpirngMVC|SpringBoot实现把表单数据转化成json字符串传递到Controller实现保存数据到数据库时遇到:Cannot construct instance of `xxxxxxx` (no Creators, like default construct, exist)异常
是由于xxxxxxx实体类中没有写无参构造方法

如:若实体类为

ConnectionVo.java

 

 

必须有无参的构造方法,否则在POST请求传入JSON.stringify(xxx)的json字符串数据,在Controller中用@RequestBody注解映射实体时就会报Cannot construct instance of `xxxxxxx` (no Creators, like default construct, exist)异常

posted on 2022-06-04 22:46  活泼的甜薯  阅读(4543)  评论(0编辑  收藏  举报