天天看點

Field roomService in edu.hpu.controller.GuestController required a bean of type 'edu.hpu.service.Roo

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2019-05-26 16:54:56.276 ERROR 8516 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Field roomService in edu.hpu.controller.GuestController required a bean of type 'edu.hpu.service.RoomService' that could not be found.


Action:

Consider defining a bean of type 'edu.hpu.service.RoomService' in your configuration.      

用spring boot報了這麼個錯,其實解決辦法很簡單,在edu.hpu.service.impl.RoomServiceImpl添加一個@Service注解。具體原因以後再學習,先跑起來。

上面這個是service,接下來,mapper也面臨了同樣的問題

Field roomMapper in edu.hpu.service.impl.RoomServiceImpl required a bean of type 'edu.hpu.mapper.RoomMapper' that could not be found.


Action:

Consider defining a bean of type 'edu.hpu.mapper.RoomMapper' in your configuration.


Process finished with exit code 0      

同樣思路,在RoomMapper接口中添加@Mapper注解。