错误描述:
Invalid bean definition with name ‘userMapper‘ defined in file
意思是文件中定义的名为“userMapper”的bean定义无效。
看报错的服务pom文件中spring-boot-starter-web版本是3.3.5
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>3.3.5</version>
</dependency>
但mybatis是2.2.2
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
将mybatis版本改为最新的版本(3.0.3),问题就解决了
所以可能是spring boot版本与mybatis版本不兼容,不同版本的Spring Boot和MyBatis可能具有不同的特性和依赖要求,因此不兼容的两个版本有可能导致spring boot没能自动配置mybatis。
1528






