坑爹的Spring

18:04:21,581 [main] INFO JedisPoolFactory.java:111 - init jedis pools, size:7
18:04:24,798 [main] ERROR RoseFilter.java:307 - [Rose-1.2-SNAPSHOT@Spring-3.1.2.RELEASE]:Error creating bean with name 'ModuleBuilder.com.jingwei.aut.controllers.LoginController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.jingwei.aut.service.PermissionService com.jingwei.aut.controllers.LoginController.pService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.jingwei.aut.service.PermissionService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ModuleBuilder.com.jingwei.aut.controllers.LoginController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.jingwei.aut.service.PermissionService com.jingwei.aut.controllers.LoginController.pService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.jingwei.aut.service.PermissionService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)


没有实现类!!!!
@Component实现类的头上没有注解!!!!


例子2:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.jingwei.card.passport.home.MainAccountHome] is defined: expected single bean but found 2

问题原因:
在core包中:
<context:component-scan name-generator="com.jingwei.core.spring.BeanNameGenerator" base-package="com.jingwei.card.passport.component"></context:component-scan>
<context:component-scan name-generator="com.jingwei.core.spring.BeanNameGenerator" base-package="com.jingwei.card.passport.home"></context:component-scan>

而在web工程中
<context:component-scan base-package="com.jingwei" />

结论:
这个类被扫了两遍,所以在getInstant的时候,会找到两个

解决:
web工程或者其他工程中,应该尽量扫描自己的目录
<context:component-scan base-package="com.jingwei.cardverify" />
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值