Error creating bean with name 'itemController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.e3mall.manager.itemservice.ItemService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(type=class java.lang.Object, shareable=true, mappedName=, lookup=, authenticationType=CONTAINER, description=, name=)}
错误原因:
classpath:spring/applicationContext-*.xml; 在启动项目时,找不到你指定的位置; 此时的配置只能在classpath下找,无法在其他文件夹下找;具体位置因在target目录下。
解决:
在classpath后加*:classpath*:spring/applicationContext-*.xml