ror creating bean with name 'alarmController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: cn.yjxxclub.shijie.service.AlarmService cn.yjxxclub.shijie.controller.AlarmController.alarmService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.yjxxclub.shijie.service.AlarmService] 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)}


解决:


1 spring.xml文件中没有扫描到service


2 service 中没有@Service注解