错误
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘roleController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.sks.service.RoleService com.sks.controller.RoleController.roleService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.sks.service.RoleService] 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)}
解决方法
大多数情况下这种类型的错误是因为在dao层和servie没有加入对应的注解出现的问题,检查是否加入注解即可。