最近用SpringBoot写了一个项目,作为小程序的后台接口,开始的时候没有问题,当一系列的VO、service、impl、controller等方法写完以后,发现无法启动,报如下错误:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field icbc in com.yundaotu.hebi.service.AppImpl required a bean of type 'com.wx.service.IcbcService' 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.wx.service.IcbcService' in your configuration.
上网查找原因说是找不到那个类,需要添加一个注解:
在springboot启动类上添加注解 @ComponentScan(basePackages = { "com.wx" }),添加之后但仍然没有解决;
于是经过各种仔细检查,发现是IcbcServiceImpl的接口实现类上没有添加@Service注解
添加之后 启动成功