项目场景:
在ssm框架中进行删除数据是报错Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Mapper method ‘com.springmvc.dao.AdminMapper.deleteUser’ has an unsupported return type: class com.springmvc.entity.Admin
问题描述:
Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Mapper method ‘com.springmvc.dao.AdminMapper.deleteUser’ has an unsupported return type: class com.springmvc.entity.Admin
//删除用户
@RequestMapping(value = "/DeleteUser",method = RequestMethod.GET)
public String DeleteUser(@RequestParam String userName)throws IOException {
adminService.deleteUser(userName);
return "admin/userManage";
}
原因分析:
1,检查dao层与xml的全类名是否一致2,检查方法名与是否dao层是否一致
3,返回类型是是否一致
解决方案:
问题就是返回值类型出现的,我在xml中写了一个update语句返回的类型是Strintg,dao层也是返回类型也是String但是忽略了一个问题。update默认返回的类型是int 所以出现了 has an unsupported return type 的错误。
去吧删除这个方法的类型该回去就好了。