springboot在controller中使用了autowired注解,会导致工程无法启动

报错信息如下:
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)}

controller中使用了注解autowired

但是把controller里的注解去掉,service和dao中还存在autowired注解,不会影响工程正常启动
启动正常

service中含有autowired注解

附一张工程结构的截图,application所有包都包含在application所在的包中
图片说明

UserService的那个接口的实现Spring容器没有扫描到。

service类是这样的,不知道为什么没有扫描到。
图片说明

配置文件里边有没有设置扫描资源的路径?

去掉 Controller 上的@EnableAutoConfiguration注解,看看是否可行,如果不行,在 Application 上加上@CompoentScan

@ComponentScan(basePackages="com.templates")
启动路径不一致~我也是出现类似问题~

我加了@ComponentScan(basePackages="com.templates"),还是报找不到service的实现类?