***************************
APPLICATION FAILED TO START
***************************

Description:

Field stuService in com.example.DingDong.controller.StuController required a bean of type 'com.example.DingDong.service.StuService' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.example.DingDong.service.StuService' in your configuration.

 

因为StuService没有被SpringBoot的自动装配扫描到,解决办法就是在SpringBootApplication类上加一行注解指定需要被装配的Service包

@ComponentScan(basePackages = {"com.example.DingDong.service"})

 

更多推荐

Consider defining a bean of type 'xxx' in your configuration. 问题