mybatis Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying

Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type ‘com.spring.mvc.service.UserService’ available: expected single matching bean but found 2: userServiceImpl,userService
at org.springframework.beans.factory.config.DependencyDescriptor.resolveNotUnique(DependencyDescriptor.java:217)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1215)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor A u t o w i r e d F i e l d E l e m e n t . i n j e c t ( A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r . j a v a : 593 ) . . . 39 m o r e 四 月 20 , 20196 : 50 : 46 上 午 o r g . a p a c h e . c a t a l i n a . c o r e . A p p l i c a t i o n C o n t e x t l o g 严 重 : S t a n d a r d W r a p p e r . T h r o w a b l e o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . U n s a t i s f i e d D e p e n d e n c y E x c e p t i o n : E r r o r c r e a t i n g b e a n w i t h n a m e ′ m a i n C o n t r o l l e r ′ : U n s a t i s f i e d d e p e n d e n c y e x p r e s s e d t h r o u g h f i e l d ′ u s ′ ; n e s t e d e x c e p t i o n i s o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . N o U n i q u e B e a n D e f i n i t i o n E x c e p t i o n : N o q u a l i f y i n g b e a n o f t y p e ′ c o m . s p r i n g . m v c . s e r v i c e . U s e r S e r v i c e ′ a v a i l a b l e : e x p e c t e d s i n g l e m a t c h i n g b e a n b u t f o u n d 2 : u s e r S e r v i c e I m p l , u s e r S e r v i c e a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . a n n o t a t i o n . A u t o w i r e d A n n o t a t i o n B e a n P o s t P r o c e s s o r AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ... 39 more 四月 20, 2019 6:50:46 上午 org.apache.catalina.core.ApplicationContext log 严重: StandardWrapper.Throwable org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainController': Unsatisfied dependency expressed through field 'us'; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.spring.mvc.service.UserService' available: expected single matching bean but found 2: userServiceImpl,userService at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)...39more20,20196:50:46org.apache.catalina.core.ApplicationContextlog:StandardWrapper.Throwableorg.springframework.beans.factory.UnsatisfiedDependencyException:ErrorcreatingbeanwithnamemainController:Unsatisfieddependencyexpressedthroughfieldus;nestedexceptionisorg.springframework.beans.factory.NoUniqueBeanDefinitionException:Noqualifyingbeanoftypecom.spring.mvc.service.UserServiceavailable:expectedsinglematchingbeanbutfound2:userServiceImpl,userServiceatorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessorAutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
解决方法:

<!-- mapper动态代理开发 ,使用MyBatis基于注解的方式对数据集操作 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.spring.mvc.dao"></property>
	</bean>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值