Error creating bean with name ‘xxxMapper‘,Invocation of init method failed; nested exception is java

1. 问题描述

使用的springboot2.7.17版本,mybatisplus为3.5.3.1

2. 报错信息:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userInfoMapper’ defined in file [D:\proj\target\classes\cn\dlgong\fastpan\mapper\UserInfoMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required

报错内容

3. 解决办法:

网上有说没有加注解的
有说mapper扫描有误的
有说mybatisplus版本和springboot不匹配的
有说xml中的特殊符号被编译的

我都不是网上的这些情况,搞了半天没搞出来,最后重新检查pom文件,发现mybatisplus依赖错乱了,搞成了mybatis-plus,真的太无语了……
Error creating bean with name ‘xxxMapper‘,Invocation of init method failed; nested exception is java_第1张图片

解决:

导入正确的springboot版本的mybatisplus依赖即可
Error creating bean with name ‘xxxMapper‘,Invocation of init method failed; nested exception is java_第2张图片

你可能感兴趣的:(报错集合,1024程序员节,java,intellij-idea,mysql,mybatis,spring,boot)