BindingException:Mapper method 'com.example.demo.dao.CartDao.getStock attempted to return null fr...

以前敲代码一直不注意区别Integer和int,直接混用,今天写一个mybais的xml时,

BindingException:Mapper method 'com.example.demo.dao.CartDao.getStock attempted to return null fr..._第1张图片
xml


dao

发现查询结果为null时

org.apache.ibatis.binding.BindingException: Mapper method 'com.example.demo.dao.CartDao.getStock attempted to return null from a method with a primitive return type (int).

把dao,service返回值类型都改成统一的Integer就没有错误了

你可能感兴趣的:(BindingException:Mapper method 'com.example.demo.dao.CartDao.getStock attempted to return null fr...)