I am upgrading spring cloud, i earlier had a bean to add additional filter as below

@Bean @ConditionalOnMissingBean(DiscoveryClient.DiscoveryClientOptionalArgs.class) public DiscoveryClient.DiscoveryClientOptionalArgs discoveryClientOptionalArgs() { List<ClientFilter> filters = new ArrayList<>(); filters.add(new ClientFilterAdapter(jwtAuthRequestDecorator())); DiscoveryClient.DiscoveryClientOptionalArgs args = new DiscoveryClient.DiscoveryClientOptionalArgs(); args.setAdditionalFilters(filters); return args; }

In the newer version of DiscoveryClient, DiscoveryClientOptionalArgs is removed/deprecated. could you please help me with another way to implement the same?

jwtAuthRequestDecorator is nothing but a bean to add additional header

public HttpHeaders getHeaders() { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add(TOKEN, jwtToken); return httpHeaders; }

Comment From: tarunrohila

Thanks, I fixed it by creating new RestTemplateDiscoveryClientOptionalArgs

@Bean public RestTemplateDiscoveryClientOptionalArgs discoveryClientOptionalArgs(HeaderHttpRequestInterceptor headerInterceptor) throws Exception { RestTemplateDiscoveryClientOptionalArgs args = new RestTemplateDiscoveryClientOptionalArgs(new CustomEurekaClientHttpRequestFactorySupplier(headerInterceptor)); return args; }