Closed
Description
In org.springframework.ws.transport.http.HttpComponents5MessageSender.afterPropertiesSet() (retrieved 26mar25), if you use property injection instead of constructor injection to set the httpClient, the httpClient is silently overwritten by the clientFactory.
This user error would be easier to diagnose if you added a check in afterPropertiesSet(), similar to the check in other methods:
@Override
public void afterPropertiesSet() throws Exception {
if (this.clientFactory != null) {
if (getHttpClient() != null) {
throw new IllegalStateException(HTTP_CLIENT_ALREADY_SET);
}
this.httpClient = this.clientFactory.getObject();
}
}