SpringBoot 4.0.0 RC = OK but 4.0.0 (GA) yields Consider defining a bean of type 'org.springframework.web.reactive.function.client.WebClient$Builder' in your configuration.
Hello Spring Boot team,
Big congrats on the release of 4.0.0!!!
Sorry for the trouble, but I would like to raise an issue which happened between the upgrade from 4.0.0 RC to 4.0.0 (the GA).
I have a bean like this:
@Bean
public WebClient getWebClient(final WebClient.Builder builder) {
final var clientHttpConnector = new ReactorClientHttpConnector(HttpClient.create().wiretap(true).protocol(HttpProtocol.HTTP11));
return builder.baseUrl(hostAndPort).defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).clientConnector(clientHttpConnector).build();
}
And in my pom, there is the starter webclient
And with 4.0.0 RC, this would not encounter any issue.
However, with 4.0.0,
I am always facing this:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method getWebClient in com.WebClientConfiguration required a bean of type 'org.springframework.web.reactive.function.client.WebClient$Builder' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.web.reactive.function.client.WebClient$Builder' in your configuration.
I understand there is a modularization work in 4.0.0, I did look at the release note, the delta PRs between RC and the GA one, but no luck.
It seems this bean was available, but now, it is not anymore.
Could you please help on this issue?
Thank you.
We can try to help, but we'll need some more information. A minimal sample that reproduces the problem would be very useful.
Based on what you've described thus far, I would guess that a jar has been corrupted when it was downloaded. That happens somewhat regularly with Maven. If you're using Gradle, it's likely to be something else.
Maybe you are missing dependency org.springframework.boot:spring-boot-starter-webclient.
@quaff are you aware of changes in 4.0.0 that would explain a difference there? spring-boot-starter-webclient was already present in 4.0.0-RC1 so I assume @mcpauthfan is already using it.
Indeed. They've said as much in the issue description:
And in my pom, there is the starter webclient
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
I just ran into the same issue upgrading from 3.5 to 4.0; resolved by removing the (WebClient.Builder webClientBuilder) dependency injection in constructor and using WebClient.builder() directly.