Describe the bug

The retry logic seems to have a bug where every time a new request is made the defaultQueryParameters is added to the requested URL

Spring Cloud Version: 2020.0.3

Logs:

[RemoteClient#get] ---> GET http://localhost:1234?param=paramValue HTTP/1.1
[RemoteClient#get] ---> END HTTP (0-byte body)
[RemoteClient#get] <--- ERROR ConnectException: Connection refused (Connection refused) (1007ms)
[RemoteClient#get] ---> RETRYING
[RemoteClient#get] ---> GET http://localhost:1234?param=paramValue&param=paramValue HTTP/1.1
[RemoteClient#get] ---> END HTTP (0-byte body)
[RemoteClient#get] <--- ERROR ConnectException: Connection refused (Connection refused) (1001ms)
[RemoteClient#get] ---> RETRYING
[RemoteClient#get] ---> GET http://localhost:1234?param=paramValue&param=paramValue&param=paramValue HTTP/1.1
[RemoteClient#get] ---> END HTTP (0-byte body)
[RemoteClient#get] <--- ERROR ConnectException: Connection refused (Connection refused) (1001ms)
[RemoteClient#get] ---> RETRYING
[RemoteClient#get] ---> GET http://localhost:1234?param=paramValue&param=paramValue&param=paramValue&param=paramValue HTTP/1.1
[RemoteClient#get] ---> END HTTP (0-byte body)
[RemoteClient#get] <--- ERROR ConnectException: Connection refused (Connection refused) (1000ms)

Sample Code

@SpringBootApplication
@EnableFeignClients
public class MultiQueryParamApplication {


    @FeignClient(value = "client", url = "http://localhost:1234")
    public interface RemoteClient {

        @GetMapping
        void get();

    }

    public static void main(String[] args) {
        SpringApplication.run(MultiQueryParamApplication.class, args);
    }

    @Bean
    public Retryer retryer() {
        return new Retryer.Default();
    }

    @Bean
    public ApplicationRunner runner(RemoteClient client) {
        return args -> client.get();
    }

}

application.properties

logging.level.root=DEBUG
feign.client.config.default.connectTimeout = 1000
feign.client.config.default.readTimeout = 1000
feign.client.config.default.loggerLevel = full
feign.client.config.default.defaultQueryParameters.param = paramValue

Comment From: lhcopetti

It seems this code might be related to the issue above:

FeignClientFactoryBean.java

    protected void configureUsingProperties(FeignClientConfiguration config, Builder builder) {

...
            if (Objects.nonNull(config.getDefaultQueryParameters())) {
                builder.requestInterceptor((requestTemplate) -> {
                    requestTemplate.queries(config.getDefaultQueryParameters());
                });
            }
...

According to feign, requestInterceptor objects might be created once but are reapplied for each retry which will lead to the problem mentioned above.