-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
What problem are you trying to solve?
Add Spring Boot starter spring-boot-starter-webclient, provided in a separate starter as of Spring Boot 4.
See details here:
With Spring Boot 4.0, applications can now use the “org.springframework.boot:spring-boot-starter-webclient” or “org.springframework.boot:spring-boot-starter-restclient” to express the need for an HTTP client.
Steps
- add dependency
spring-boot-starter-webclientiforg.springframework.web.reactive.function.client.WebClientis used in project - add dependency
spring-boot-starter-webclient-testiforg.springframework.web.reactive.function.client.WebClientis used in project - remove dependency
reactor-test(dependency ofspring-boot-starter-webclient-test) - rename some classes from
org.springframework.boot.web.reactive.function.clienttoorg.springframework.boot.webclient
Quick start
A first recipe that I tested. Second part is in its own recipe to ease testing.
Maybe some classes are missing from the package renaming.
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot4.AddWebClientStarter
displayName: Add missing WebClient Spring Boot Starter
description: >-
Add Spring Boot starter `spring-boot-starter-webclient`, provided in a separate starter as of Spring Boot 4.
See details about [new Spring Boot Starters](https://spring.io/blog/2025/09/30/the-state-of-http-clients-in-spring#new-spring-boot-starters).
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.dependencies.AddDependency:
groupId: org.springframework.boot
artifactId: spring-boot-starter-webclient
scope: compile
acceptTransitive: false
onlyIfUsing: "org.springframework.web.reactive.function.client.WebClient"
- org.openrewrite.java.dependencies.AddDependency:
groupId: org.springframework.boot
artifactId: spring-boot-starter-webclient-test
scope: test
acceptTransitive: false
onlyIfUsing: "org.springframework.web.reactive.function.client.WebClient"
# remove reactor-test, dependency of spring-boot-starter-webclient-test
- org.openrewrite.java.dependencies.RemoveDependency:
groupId: io.projectreactor
artifactId: reactor-test
scope: test
configuration: testImplementation
- org.openrewrite.java.spring.boot4.WebClientPackageRenaming
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot4.WebClientPackageRenaming
displayName: Package name change in `spring-boot-webclient`
description: >-
Package name change in `spring-boot-webclient`.
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.ChangePackage:
oldPackageName: org.springframework.boot.web.reactive.function.client
newPackageName: org.springframework.boot.webclient
recursive: true
- org.openrewrite.java.ChangePackage:
oldPackageName: org.springframework.boot.autoconfigure.web.reactive.function.client
newPackageName: org.springframework.boot.webclient.autoconfigure
recursive: trueAny additional context
References:
Related:
- Add missing RestClient Spring Boot Starter (Spring Boot 4) #871
- feat: Adopt an initial few modular Spring Boot 4.0 starters #860
Are you interested in [contributing this recipe to OpenRewrite]
OK
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done