微服务项目如何引入Feign?会遇到什么坑?

Feign基础搭建

https://blog.csdn.net/qq_41319712/article/details/109617249

引入出现报错

Method springSecurityFilterChain in org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration required a bean named 'loginUserServiceImpl' that could not be found.

原因是 @FeignClient("xx")服务名引用错了,应引用bootstrap.yml中的服务名,不应在application.yml中新建服务名,导致冲突报错
bootstrap.yml 中的服务名是因为nacos服务需在其中配置

缺失token报错

https://www.cnblogs.com/ygreatred/p/15986657.html#:~:text=feign服务中调用,传递token 1 1、先实现请求拦截器 2 2.在%40FeignClient接口里添加configuration,%3D {FeignConfig.class} 3 3、解决feign中RequestContextHolder.getRequestAttributes ()为null方案有两种:

请求超时报错

https://blog.csdn.net/hanzhen2010/article/details/116303368

以上,暂时还未发现其他问题。

posted @ 2023-03-20 14:15  夜旦  阅读(18)  评论(0编辑  收藏  举报