日常报错 - 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类中找不到构造方法,如果一个类没有写构造方法,系统会自动添加一个无参的构造方法;如果自己写了一个自定义的构造方法,系统则不再自动生成,所以会产生这个错误。


解决方法:

添加无参构造方法

 

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

 

posted @ 2020-02-20 13:58  郑为中  阅读(1606)  评论(0编辑  收藏  举报