@Resource注解失败之抽象类

太久没复习java基础知识了。今天在写代码的时候,把一个Service类写成abstract的,然后就开始报错了。。

ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed>

  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSock': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.xxxx.cms.service.UserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(mappedName=, shareable=true, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER, lookup=)}

排查了半天,发现是由于抽象类不能实例化导致的注入失败。。哎,该好好复习下基础知识了。

猜你喜欢

转载自blog.csdn.net/u012799221/article/details/80066639