Springboot2.0整合tk.mybatis出问题
程序员文章站
2022-07-15 10:10:56
...
Springboot2.0整合tk.mybatis出问题
SpringBoot与tk.mybatis整合遇到的问题
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'componentController': Unsatisfied dependency expressed through field 'XXXXService';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'componentServiceImpl': Unsatisfied dependency expressed through field 'componentMapper';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ds1ComponentMapper' defined in file [XXXXXXX]: Cannot resolve reference to bean 'ds1SqlSessionTemplate' while setting bean property 'sqlSessionTemplate';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ds1SqlSessionFactory': Invocation of init method failed;
nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: -41
Springboot1.X升级成2.X整合通用mapper时候,出现无法创建通用mapper生成的mapper文件的bean。
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
</dependency>
这个里面增添
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<exclusions>
<exclusion>
<artifactId>mybatis</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
<exclusion>
<artifactId>mybatis-spring</artifactId>
<groupId>org.mybatis</groupId>
</exclusion></exclusions>
就完美解决了
推荐阅读
-
**Mybatis和Spring整合的时候 sqlSessionFactory出问题了!!求指点**
-
SpringBoot 2.x 整合Mybatis三:tk.mybatis
-
SpringBoot(九)SpringBoot整合tk.mybatis
-
springboot整合tk.mybatis入门2 通用service
-
SpringBoot与tk.mybatis整合遇到的问题
-
Springboot2.0整合tk.mybatis出问题
-
SpringBoot整合使用tk.mybatis配置及测试
-
springboot整合tk.mybatis
-
springboot2.0整合使用Apollo配置中心
-
springboot2.0版本 Mybatis 整合