ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
对于被hystrix注解的controller方法,其线程与其对应切面线程不一致,导致attributes为空
2021-02-25/15:17:46.422 logback [http-nio-8000-exec-3] INFO c.y.kjcxweb.aop.RateLimiterAspect - aspect----- doAround threadName:Thread[http-nio-8000-exec-3,5,main]
2021-02-25/15:17:49.648 logback [hystrix-lx-1] INFO c.y.k.m.c.i.WaybillRecordsController - controller----queryLx threadName:Thread[hystrix-lx-1,5,main]
2021-02-25/15:17:49.648 logback [hystrix-lx-1] INFO c.y.k.m.s.i.WaybillRecordsServiceImpl - service-------serviceLx threadName:Thread[hystrix-lx-1,5,main]
最后
以上就是现实哑铃最近收集整理的关于RequestContextHolder.getRequestAttributes()为空与hystrix关系的全部内容,更多相关RequestContextHolder内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复