Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

springCloud中的RestTemplateConfiguration自定义Feign.Builder拦截与开启hystrix冲突 #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kissMeet
Copy link

作者在springCloud客户端中的RestTemplateConfiguration自定义Feign.Builder拦截Feign请求传递GroupId,这与开启hystrix冲突,feign开启hystrix后,定义了SleuthHystrixFeignBuilder,Feign.Builder全局只能有一个。

解决方法:改用bean的方式添加自定义的RequestInterceptor

然后发现事务参与者获取RequestContextHolder.getRequestAttributes()为null
原因:RequestContextHolder是一个threadlocal变量,事务参与者是新开线程执行的,传递不过去,需要在ActorTxTransactionHandler中传递一下RequestContextHolder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant