ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 添加FeignClient访问其他微服务权限 > 其他步骤参考【为提供者添加资源防护】 ```java package com.gosuncn.config; @Configuration public class FeignClientOAuth2RelayConfig { @Bean public FeignClientOAuth2RelayRequestInterceptor feignClientOAuth2RelayRequestInterceptor() { return new FeignClientOAuth2RelayRequestInterceptor(); } public static class FeignClientOAuth2RelayRequestInterceptor implements RequestInterceptor { @Override public void apply(RequestTemplate template) { RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); if (requestAttributes != null) { String token = ((ServletRequestAttributes) requestAttributes).getRequest().getHeader("Authorization"); if (token != null && !"".equals(token.trim())) { template.header("Authorization", token); } } } } } ```