Unsatisfied dependency expressed through field ‘baseMapper‘; nested exceptio

本文介绍了在使用Mybatis-Plus时遇到的报错原因及解决方法,重点是导入正确的依赖和使用@Mapper与@Service注解。确保在mapper接口上加上@Mapper注解,并在service接口实现类中加入@Service注解,以正确整合SpringBoot与Mybatis-Plus。

这个报错主要是在我是用mybatis-plus的时候遇到的,出现这个报错的原因主要有以下两点:

  1. 导入的依赖的问题:
    注意在使用spring boot整合mybatis-plus时导入的是如下依赖
        <dependency>
            <groupId>io.github.Caratacus</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
        <version>1.0.9</version>

而不是:

       <dependency>-->
            <groupId>com.suyeer</groupId>-->
            <artifactId>mybatis-plus</artifactId>-->
            <version>3.2.0.6</version>-->
        </dependency>-->
  1. 注解问题
    在mapper文件中的类中加入@Mapper注解
@Mapper
public interface UserMapper extends BaseMapper<Users> {
}

service接口实现类中加入@Service注解

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, Users> implements UserService {
}
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdWorkHourServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'psmPjtServiceImpl': Unsatisfied dependency expressed through field 'plnMilstnService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plnMilStnServiceImpl': Unsatisfied dependency expressed through field 'psmPjtmilstnService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'psmPjtmilstnServiceImpl': Unsatisfied dependency expressed through field 'objectTypeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'objectTypeServiceImpl': Unsatisfied dependency expressed through field 'lcTranService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcTranServiceImpl': Unsatisfied dependency expressed through field 'lclcPhaseService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcLcPhaseServiceImpl': Unsatisfied dependency expressed through field 'lcLcService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcLcServiceImpl': Unsatisfied dependency expressed through field 'wfWorkflowService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfWorkflowServiceImpl': Unsatisfied dependency expressed through field 'sysViewInfoService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysViewInfoService': Unsatisfied dependency expressed through field 'wfFieldService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfFieldServiceImpl': Unsatisfied dependency expressed through field 'pageFieldService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfPageFieldServiceImpl': Unsatisfied dependency expressed through field 'wfPageService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfPageServiceImpl': Unsatisfied dependency expressed through field 'wfTabService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfTabServiceImpl': Unsatisfied dependency expressed through field 'nodeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfNodeServiceImpl': Unsatisfied dependency expressed through field 'wfTransitionService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfTransitionServiceImpl': Unsatisfied dependency expressed through field 'viewComponent'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'viewComponentImpl': Unsatisfied dependency expressed through field 'valueConverComponent'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dyValueConverComponentImpl': Unsatisfied dependency expressed through field 'objOprefService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'objOprefServiceImpl': Unsatisfied dependency expressed through field 'actionHandler'; nested exceptio n is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'actionHandlerImpl': Unsatisfied dependency expressed through field 'entityExportComponent'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityExportComponentImpl': Unsatisfied dependency expressed through field 'versionsPlanComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dyVersionsPlanComponentImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'taskHandlerImpl': Bean with name 'taskHandlerImpl' has been injected into other beans [actionController,bizCommServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesForType' with the 'allowEagerInit' flag turned off, for example.
最新发布
10-18
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值