bean依赖注入错误:Error creating bean with name 'itemService': Injection of autowired dependencies failed

来源:互联网 发布:韦德体测数据 编辑:程序博客网 时间:2024/05/16 20:23


错误代码(贴的前部分):

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.taotao.manage.service.ItemDescService com.taotao.manage.service.ItemService.itemDescService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.taotao.manage.service.ItemDescService] 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)}

错误原因:


再service上@Service注解忘记添加了,导致bean找不到ItemDescService。


SSM书写步骤大致如下:

contorller

@RequestMapping(value="item")@Controllerpublic class ItemContorller {@Autowiredprivate ItemService itemService;}
service
@Servicepublic class ItemService extends BaseService<Item>{@Autowiredprivate ItemMapper itemMapper;}
mapper,继承pojo
public interface ItemMapper extends Mapper<Item> {}



阅读全文
3 0
原创粉丝点击