Feign 通用 token

@Component
public class FeignConfig implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = attributes.getRequest();
        //token
        requestTemplate.header("Authorization", request.getHeader("Authorization"));
    }
}

你可能感兴趣的:(Feign 通用 token)