iBatis中java.lang.InstantiationException错误的原因

在调试ibatis的工程中出现了这个问题:

Cause: java.lang.RuntimeException: JavaBeansDataExchange could not instantiate result class.  Cause: java.lang.InstantiationException: test_agent_ibatis.ibatis.User

查资料后说是不能实例化对象

因为在ibatis在对象简历中,会使用不带参数的构造函数来创建对象,但是我的User类中没有无参构造。(因为之前需要有参构造方法,忽略了无参构造)

在User类中加了无参构造就运行正常了。

猜你喜欢

转载自blog.csdn.net/qq_37723897/article/details/80354504