如何在springboot的ClientHttpRequestInterceptor中使用自动连线注释
我想使用如何在springboot的ClientHttpRequestInterceptor中使用自动连线注释,spring,spring-boot,redis,autowired,spring-data-redis,Spring,Spring Boot,Redis,Autowired,Spring Data Redis,我想使用@Autowired在springboot public class RequestResponseHandlerInterceptor implements ClientHttpRequestInterceptor { @Autowired private localService localService; @Autowired private RedisTemplate<String, String> redisTemplate;
@Autowired
在springboot
public class RequestResponseHandlerInterceptor implements ClientHttpRequestInterceptor {
@Autowired
private localService localService;
@Autowired
private RedisTemplate<String, String> redisTemplate;
private static final String AUTHORIZATION = "Authorization";
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
ClientHttpResponse response = null;
------
------
return response;
}
}
公共类RequestResponseHandlerInterceptor实现ClientHttpRequestInterceptor{
@自动连线
专用本地服务本地服务;
@自动连线
私有再贴现模板;
私有静态最终字符串AUTHORIZATION=“AUTHORIZATION”;
@凌驾
公共ClientHttpResponse截获(HttpRequest请求,字节[]正文,ClientHttpPrequesteExecution执行)引发IOException{
ClientHttpResponse响应=null;
------
------
返回响应;
}
}
您能详细说明一下您的情况吗。另请参阅我想通过redistemplate的access实例和我的本地服务进行一些预处理。你能在你想使用ClientHttPrequestinterCeptor的地方分享代码块吗?请详细说明你的案例。另请参阅我想通过redistemplate的access实例和我的本地服务进行一些预处理。您能在希望使用ClientHttpRequestInterceptor的地方共享代码块吗