StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException

1.最近在跟着视频学习淘淘商城项目,在第五天时,出现了这样的错误:

 

该项目用的是maven管理,具体错误为:

1)Error creating bean with name 'itemCatController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.taotao.rest.service.ItemCatService com.taotao.rest.controller.ItemCatController.itemCatService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.taotao.rest.service.ItemCatService] 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:334)

2)org.springframework.beans.factory.BeanCreationException

意思找到不到对应的bean,bean注入失败,即service注入controller失败。

2.后来经过网上查找方法,才发现是自己对应包的注解扫描包配置结构出现错误,具体如下:

对应的应该是箭头标注的地方,

而我配置的错误方法如下:把其具体实现的service包是com.taotao.rest.serviceImpl,配置成了com.taotao.rest.service

究其原因,原视频开发是用ecplise开发,而自己用的是myecplise,创建包结构展开方式不同,myecplise创建包结构是分开的,而ecplise创建的service和其实现类serviceImpl都是在com.taotao.service包下,这样只看视频操作就可能出错,以后要多注意。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值