java.lang.IllegalStateException: Request caching is not available. Maybe you need to initialize the HystrixRequestContext?
at com.netflix.hystrix.HystrixRequestCache.get(HystrixRequestCache.java:104)~[hystrix-core-1.5.18.jar:1.5.18]
at com.netflix.hystrix.AbstractCommand$7.call(AbstractCommand.java:478)~[hystrix-core-1.5.18.jar:1.5.18]
at com.netflix.hystrix.AbstractCommand$7.call(AbstractCommand.java:454)~[hystrix-core-1.5.18.jar:1.5.18]
at
解决办法
/**
* Created by macro on 2019/9/4.
*/@Component@WebFilter(urlPatterns ="/*",asyncSupported =true)publicclassHystrixRequestContextFilterimplementsFilter{@OverridepublicvoiddoFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)throws IOException, ServletException {
HystrixRequestContext context = HystrixRequestContext.initializeContext();try{
filterChain.doFilter(servletRequest, servletResponse);}finally{
context.close();}}}
可能出现的异常java.lang.IllegalStateException: Request caching is not available. Maybe you need to initialize the HystrixRequestContext? at com.netflix.hystrix.HystrixRequestCache.get(HystrixRequestCache.java:104) ~[hystrix-core-1.5.18.jar:1.5.18] at com.net.