spring自动装配注入不了

Study_of_java 2016-11-27 11:33:01
spring的配置文件:

<bean id="itemsService" class="ssm.check.service.impl.ItemsServiceImpl" >
</bean>

controller的定义:

@Controller
public class ItemsController {
@Autowired
private ItemsService itemsService;

@RequestMapping("/findItemsByName")
public ModelAndView findItemsByName() {

List<ItemsCustom> itemsList = itemsService.findItemsByName(null);

ModelAndView modelAndView = new ModelAndView();

modelAndView.addObject("itemsList", itemsList);
// 视图
modelAndView.setViewName("WEB-INF/jsp/items/itemsList.jsp");

return modelAndView;
}

异常:

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ssm.check.mapper.ItemsCustomMapper ssm.check.service.impl.ItemsServiceImpl.itemsCustomMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [ssm.check.mapper.ItemsCustomMapper] 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)}

...全文
315 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

24,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧