日常报错 - NO constructor found in matching [java.lang.String]解决方法

IntelliJ IDEA 2019.3 x64 编写SSM项目的时候,报错

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: NO constructor found in ypc.ZWZ.model.User matching [java.lang.String]

 

这是因为没有在XXX类中找不到构造方法,如果一个类没有写构造方法,系统会自动添加一个无参的构造方法;如果自己写了一个自定义的构造方法,系统则不再自动生成,所以会产生这个错误。


解决方法:

添加无参构造方法

再次编译运行,就没问题了

发布了53 篇原创文章 · 获赞 37 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_41464123/article/details/104409620