feign调用在拦截器里加上cookie
-
-
public class TtpfFeignConfig {
-
-
public RequestInterceptor requestInterceptor(){//Feign同步请求头
-
return template -> {
-
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-
if (requestAttributes != null) {
-
HttpServletRequest request = requestAttributes.getRequest();
-
template.header("Cookie",request.getHeader("Cookie"));
-
}
-
};
-
}
-
}https://blog.csdn.net/yufeiluo/article/details/141421216