Seata引入导致其他包无法准确注入问题

Blade 未结 2 256
java开发
java开发 2025-01-08 17:04

一、该问题的重现步骤是什么?

1. 引入seata.pom文件后 

2. 修改启动类

3. user-api无法使用


二、你期待的结果是什么?实际看到的又是什么?

期待注入成功,注入失败

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

 springcloud 3.4.0 win

四、请提供详细的错误堆栈信息,这很重要。

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2025-01-08 17:03:22.536 ERROR 31056 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 


***************************

APPLICATION FAILED TO START

***************************


Description:


Field iuserClient in org.springblade.refinement.hotel.service.impl.HotelInfoServiceImpl required a bean of type 'org.springblade.system.feign.IUserClient' that could not be found.



Action:


Consider defining a bean of type 'org.springblade.system.feign.IUserClient' in your configuration.

五、若有更多详细信息,请在下面提供。


image.png

删除红色引入后,刷新maven后启动无异常 只要添加上就有问题

2条回答
  •  java开发
    java开发 (楼主)
    2025-01-09 08:45

    我也是看着个文档弄得我一共引用了 三个client 有两个是system-api的一个 user-api的  system的应用都能注入进去, 唯独user-api的 IUserClient注入不进去 把引用的






    注释掉 刷新一下就好了 问题点在这



    又测试了一下  启动类上加上这个 

    SeataCloudApplication

    会导致 IUserClient无法注入


    查看源码发现 

    SeataCloudApplication缺少
    @EnableFeignClients(AppConstant.BASE_PACKAGES)
    
    在启动类上增加后启动成功


代码语言
提交回复