Hello,
I have an inquiry regarding https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilder.java#L181
The method is defined as
/**
* Return a new {@link HttpComponentsClientHttpRequestFactoryBuilder} that applies
* additional customization to the underlying
* {@link org.apache.hc.client5.http.config.RequestConfig.Builder} used for default
* requests.
* @param defaultRequestConfigCustomizer the customizer to apply
* @return a new {@link HttpComponentsClientHttpRequestFactoryBuilder} instance
*/
public HttpComponentsClientHttpRequestFactoryBuilder withDefaultRequestConfigCustomizer(
Consumer<RequestConfig.Builder> defaultRequestConfigCustomizer) {
Assert.notNull(defaultRequestConfigCustomizer, "'defaultRequestConfigCustomizer' must not be null");
return new HttpComponentsClientHttpRequestFactoryBuilder(getCustomizers(), this.httpClientCustomizer,
this.connectionManagerCustomizer, this.socketConfigCustomizer, defaultRequestConfigCustomizer,
this.tlsSocketStrategyFactory);
}
according to the javadoc, the input request config builder customizer should apply addition customization, but the implementation actually replaces the previous behavior.
Is there a reason to not have this.defaultRequestConfigCustomizer.andThen(defaultRequestConfigCustomizer) instead?
Comment From: nosan
This method was added at the last moment https://github.com/spring-projects/spring-boot/issues/43139, and I think missing andThen is just an oversight.
Comment From: philwebb
Closing in favor of PR #43429. Thanks @nosan!