今天遇见了以下错误:
2021-11-02 22:06:02.810 ERROR 4316 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.UnsupportedOperationException
### The error may exist in file [E:\borrow_books\target\classes\mapper\AdminUserMapper.xml]
### The error may involve com.qi.mapper.AdminUserMapper.findAll
### The error occurred while handling results
### SQL: select * from admin_user
### Cause: java.lang.UnsupportedOperationException] with root cause
java.lang.UnsupportedOperationException: null
后来发现mapper.xml文件的结果类型写错了
错误的:(本来想的查出来的是集合,就写了一个list)
<select id="findAll" resultType="list" >
select * from admin_user
</select>
修改:(不管是对象还是集合,结果类型都是一个对象)
<select id="findAll" resultType="adminUser" >
select * from admin_user
</select>
希望可以帮助别的小伙伴,别踩这个坑了!!!