springCloud中的RestTemplateConfiguration自定义Feign.Builder拦截与开启hystrix冲突#36
Open
kissMeet wants to merge 2 commits intodromara:masterfrom
Open
springCloud中的RestTemplateConfiguration自定义Feign.Builder拦截与开启hystrix冲突#36kissMeet wants to merge 2 commits intodromara:masterfrom
kissMeet wants to merge 2 commits intodromara:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
作者在springCloud客户端中的RestTemplateConfiguration自定义Feign.Builder拦截Feign请求传递GroupId,这与开启hystrix冲突,feign开启hystrix后,定义了SleuthHystrixFeignBuilder,Feign.Builder全局只能有一个。
解决方法:改用bean的方式添加自定义的RequestInterceptor
然后发现事务参与者获取RequestContextHolder.getRequestAttributes()为null
原因:RequestContextHolder是一个threadlocal变量,事务参与者是新开线程执行的,传递不过去,需要在ActorTxTransactionHandler中传递一下RequestContextHolder