学无先后,达者为师

网站首页 编程语言 正文

错误:Cannot construct instance of `xxxx` (no Creators, like default construct , exist): cannot .......

作者:weixin_44654264 更新时间: 2022-01-19 编程语言

查了很多资料,实体类缺少无参构造

给实体类添加注解

@NoArgsConstructor  //无参构造
@AllArgsConstructor  //有参构造

当然,添加该注解之前在pom文件里添加依赖

<dependency>
   <groupId>org.projectlombok</groupId>
   <artifactId>lombok</artifactId>
</dependency>

如果还是不行,按顺序执行下面三步

添加注解后一直未起作用,重新打包之后就可以了!

原文链接:https://blog.csdn.net/weixin_44654264/article/details/118608282

栏目分类
最近更新