org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'persistenceExceptionTranslationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'persistenceExceptionTranslationPostProcessor' parameter 0: Invalid bean definition with name 'driverInfoMapper' defined in file [E:\workspace\Springsecture-01-test\target\classes\com\xgj\application\mapper\DriverInfoMapper.class]: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:795) ~[spring-beans-6.1.11.jar:6.1.11]
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'driverInfoMapper' defined in file [E:\workspace\Springsecture-01-test\target\classes\com\xgj\application\mapper\DriverInfoMapper.class]: Invalid value type for attribute 'factoryBeanObjectType': java.lang.String
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:857) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:663) ~[spring-beans-6.1.11.jar:6.1.11]
使用的是mybatis-plus-boot-starter下3.5.3.2的版本;spring-boot-starter-parent使用的是3.3.2版本报的错;启动类上加了 代码
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@MapperScan("com.xgj.application.mapper")
后面改成下面依赖
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.5</version>
</dependency>
继续报错,还是报如下错(依赖树没有冲突)
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'driverInfoServiceImpl': Unsatisfied dependency expressed through field 'baseMapper': Error creating bean with name 'driverInfoMapper' defined in file [E:\workspace\Springsecture-01-test\target\classes\com\xgj\application\mapper\DriverInfoMapper.class]: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:787) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:767) ~[spring-beans-6.1.11.jar:6.1.11]