1. 程式人生 > >SpringBoot找不到Mapper

SpringBoot找不到Mapper

例如:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-09-30 10:26:31.547 ERROR 49280 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Field tUserMapper in com.zxh.Service.Impl.UserServiceImpl required a bean of type 'com.zxh.Dao.TUserMapper' that could not be found.


Action:

Consider defining a bean of type 'com.zxh.Dao.TUserMapper' in your configuration.

需要在啟動類裡面加入

@MapperScan("com.zxh.Dao")

com.zxh.Dao為你專案Mapper介面資料夾路徑或者專案路徑

我的專案結構