作为Java新手,今天新增了一套接口,其中包括
Controller、Service、Imp、Mapper、Mapper.xml。
最后运行的时候,没有直接运行起来,报错为以下内容:
Description:
Field pieceService in com.heque.minigame.controller.PieceController required a bean of type
'com.heque.minigame.service.PieceService' 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.heque.minigame.service.PieceService' in your configuration.
最后,定位问题是在,实现类Imp实现Service的接口时,需要在实现类Imp的前面加上@Service注解。