No qualifying bean of type [com.dao.UserMapper] found for dependency:

时间:2022-09-11 15:03:20
使用 spring  +maven  + mybaits  + jetty 启动是报错 

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301) No qualifying bean of type [com.dao.UserMapper] found for dependency:
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:457)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:435)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:559)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
... 51 more
2016-01-27 13:25:15,069 (AbstractConnector.java:266) INFO [main] Started ServerConnector@352ef9c8{HTTP/1.1}{0.0.0.0:8080}
2016-01-27 13:25:15,070 (Server.java:350) INFO [main] Started @1903ms
**********Start jetty ***************




 jetty 能启动 不能调用mapper .



2 个解决方案

#1


autowire   类的依赖注入没有注入好,看一配置文件配置好没有,用的哪一种配置方式

#2


请问你后来解决了吗我好像遇到相似问题了

#1


autowire   类的依赖注入没有注入好,看一配置文件配置好没有,用的哪一种配置方式

#2


请问你后来解决了吗我好像遇到相似问题了