SSM商城系统开发笔记-问题02- Error creating bean with name 'userController'

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'com.boron.service.UserService' available: expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

原因:service层没有加注解
在搭spring mvc框架时,ide不会报错但会有编译错误的几个注意事项:
1.controller 加注解
@RestController
@RequestMapping("/user")

2.service加注解

@Service
@Autowired
3.dao 加注解和实现接口
@Param("")



posted @ 2017-04-17 17:35  Z·Fanghan  阅读(24060)  评论(0编辑  收藏  举报