我的需求:
我需要在用户模块使用公共模块的service和mapper和实体类,出现以下错误
springboot启动错误如下:
报错结果:需要一个类型为“com.buba.yka.mapper.salesmanMapper”的bean,但找不到该bean
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-07-02 21:00:53.940 ERROR 10300 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field salesmanMapper in com.business.yka.controller.BusinessController required a bean of type 'com.buba.yka.mapper.SalesmanMapper' 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.buba.yka.mapper.SalesmanMapper' in your configuration.
Process finished with exit code 1
解决问题:
business-server服务和common服务的包名不一致
所以在business-server服务中访问com.buba.yka.mapper.SalesmanMapper是访问不到的
需要两个服务的包名一致就可成功访问到
修改后
重新启动,即可启动成功