Hi All!
After updating my project to Spring 3.5.4, the behaviour of my application has changed:
With Spring Boot 3.4.8, I could override the ReactorResourceFactory
bean and to provide my custom implementation to create a Reactor Http Client. With the new version (Spring Boot 3.5.4), this component isn't used in any way, even though the Spring Boot configuration provides a default bean. Also, the documentation the both versions
say the ReactorResourceFactory
bean can be override by developers:
- Spring Boot 3.5 - Calling REST Services
- Spring Boot 3.4 - Calling REST Services
I provide a sample to show this problem: https://github.com/jorgegueyer/reactor-resource-factory-issue
To reproduce the problem, the class ReactorResourceFactoryIssueApplicationTests
must be executed with the different versions of Spring Boot defined in the pom.xml
.
The test class provides a configuration class to overwrite the ReactorResourceFactory
default bean with a custom implementation where we add some traces when the getLoopResources() and getConnectionProvider() method are invoked.
Using the version 3.4.8, we can see the following traces in the console:
ReactorResourceFactoryIssueApplicationTests in 1.415 seconds (process running for 2.459)
Getting the ConnectionProvider
Getting the LoopResources
Using the version 3.5.4 this traces don't appear.
Comment From: wilkinsona
Thanks for reporting this. It's a regression from 3.4.x due to the context's ReactorResourceFactory
not being used when creating the underlying Reactor Netty-based client. We'll work on a fix. In the meantime, you can work around the problem with the following bean:
@Bean
ClientHttpConnectorBuilderCustomizer<ReactorClientHttpConnectorBuilder> customizer(ReactorResourceFactory reactorResourceFactory) {
return (builder) -> builder.withReactorResourceFactory(reactorResourceFactory);
}
Comment From: jorgegueyer
Thanks for reporting this. It's a regression from 3.4.x due to the context's
ReactorResourceFactory
not being used when creating the underlying Reactor Netty-based client. We'll work on a fix. In the meantime, you can work around the problem with the following bean:@Bean ClientHttpConnectorBuilderCustomizer
customizer(ReactorResourceFactory reactorResourceFactory) { return (builder) -> builder.withReactorResourceFactory(reactorResourceFactory); }
Thanks for your replay. I will keep an eye on the new version. :)
Comment From: nosan
I've prepared a fix in my branch https://github.com/spring-projects/spring-boot/compare/3.5.x...nosan:46658. However, I'm not sure whether applying withReactorResourceFactory
in both org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration
and org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration
is the correct fix for 3.5.x.