diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilder.java index 19fbdfa7083d..ff8562ede025 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilder.java @@ -182,7 +182,8 @@ public HttpComponentsClientHttpRequestFactoryBuilder withDefaultRequestConfigCus Consumer defaultRequestConfigCustomizer) { Assert.notNull(defaultRequestConfigCustomizer, "'defaultRequestConfigCustomizer' must not be null"); return new HttpComponentsClientHttpRequestFactoryBuilder(getCustomizers(), this.httpClientCustomizer, - this.connectionManagerCustomizer, this.socketConfigCustomizer, defaultRequestConfigCustomizer, + this.connectionManagerCustomizer, this.socketConfigCustomizer, + this.defaultRequestConfigCustomizer.andThen(defaultRequestConfigCustomizer), this.tlsSocketStrategyFactory); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java index d9c80bab8048..bcdb86f7985d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java @@ -55,19 +55,25 @@ void withCustomizers() { TestCustomizer httpClientCustomizer2 = new TestCustomizer<>(); TestCustomizer connectionManagerCustomizer = new TestCustomizer<>(); TestCustomizer socketConfigCustomizer = new TestCustomizer<>(); + TestCustomizer socketConfigCustomizer1 = new TestCustomizer<>(); TestCustomizer defaultRequestConfigCustomizer = new TestCustomizer<>(); + TestCustomizer defaultRequestConfigCustomizer1 = new TestCustomizer<>(); ClientHttpRequestFactoryBuilder.httpComponents() .withHttpClientCustomizer(httpClientCustomizer1) .withHttpClientCustomizer(httpClientCustomizer2) .withConnectionManagerCustomizer(connectionManagerCustomizer) .withSocketConfigCustomizer(socketConfigCustomizer) + .withSocketConfigCustomizer(socketConfigCustomizer1) .withDefaultRequestConfigCustomizer(defaultRequestConfigCustomizer) + .withDefaultRequestConfigCustomizer(defaultRequestConfigCustomizer1) .build(); httpClientCustomizer1.assertCalled(); httpClientCustomizer2.assertCalled(); connectionManagerCustomizer.assertCalled(); socketConfigCustomizer.assertCalled(); + socketConfigCustomizer1.assertCalled(); defaultRequestConfigCustomizer.assertCalled(); + defaultRequestConfigCustomizer1.assertCalled(); } @Test