通过bean名获取Feign的bean

有个业务需要用el表达式调用其他服务的方法,始终说不存在这个bean。
但又能用普通代码方式正确调用,说明bean肯定存在。

后来查到feign代理会在设好的 contextId 后加上个"FeignClient"

@FeignClient(
        contextId = "remoteProductDetailService",
)
// 失败的el表达式
@remoteProductDetailService.handle()

//成功的el表达式
@remoteProductDetailServiceFeignClient.handle()
posted @ 2025-06-17 16:18  Harria  阅读(16)  评论(0)    收藏  举报