错误记录:
Error instantiating interface com.fan.admin.mapper.UserMapper with invalid types () or values (). Cause: java.lang.NoSuchMethodException: com.fan.admin.mapper.UserMapper.()] with root cause
大概的意思是:
使用无效的类型()或值()实例化接口com.fan.admin.mapper.UserMapper时出错。原因:java.lang.NoSuchMethodException: com.fan.admin.mapper.UserMapper.()]有根原因
最后发现是UserMapper.xml文件写错了返回值resultType:
<mapper namespace="com.fan.admin.mapper.UserMapper">
<!--public User getUser(Integer id);-->
<select id="getUser" resultType="com.fan.admin.entity.User">
select * from t_user where id = #{id}
</select>
</mapper>
我自己就是将返回值写成接口com.fan.admin.mapper.UserMapper,导致错误。
很明显返回的实体类型错误