org.springframework.beans.factory.BeanCreationException:Error creating bean with name

错误描述,运行测试类,测试Service类的时候报错:

org.springframework.beans.factory.BeanCreationException:Error creating bean with name

错误原因:错误具体描述如下:

org.springframework.beans.factory.BeanCreationException:Error creating bean with name

使用注解装配 bean 时发生错误。

    @Resource
    private TaskService taskService;

错误分析:犯了一个很低级的错误,TaskServiceImpl 没有去实现 TaskService接口,如下图所示。

org.springframework.beans.factory.BeanCreationException:Error creating bean with name

错误解决:TaskServiceImpl 实现 TaskService接口,如下图所示。

org.springframework.beans.factory.BeanCreationException:Error creating bean with name

如何避免这个问题: 使用 @Override 注解重写的方法。

org.springframework.beans.factory.BeanCreationException:Error creating bean with name