springboot在controller中使用autowired注解导致工程启动失败,但是在dao和service里面使用却不会导致工程无法启动
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tempControllor': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.templates.service.UserService com.templates.controller.TempControllor.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.templates.service.UserService] 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指定名称
TempController截图贴一下啊!?