openrewrite / openrewrite/rewrite-spring
feat: Add UpgradeSpringData_4_0 recipe for Spring Data 2025.1 / Spring Boot 4 migration
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 403
- Forks
- 149
- Avg merge
- 2h 33m
- Merged PRs (30d)
- 10
Description
Is your feature request related to a problem? Please describe.
The current UpgradeSpringBoot_4_0 recipe (spring-boot-40.yml) chains through Spring Boot 3.5, Spring Framework 7.0, Spring Security 7.0 and SpringDoc 3.0 — but it does not include any recipe for Spring Data 2025.1 / Spring Data JPA 4.0.
The docs page at https://docs.openrewrite.org/recipes/java/spring/data only lists recipes up to UpgradeSpringData_3_4. There is no UpgradeSpringData_4_0 recipe, and no spring-data-4.yml file in the repository.
This leaves a significant migration gap for users upgrading to Spring Boot 4 / Spring Data JPA 4.0.6 (released November 2025 as part of the Spring Data 2025.1 release train).
Describe the solution you'd like
A new spring-data-4.yml file with at minimum an UpgradeSpringData_4_0 composite recipe, and the corresponding ChangeType recipes for all class relocations caused by Spring Boot 4's modularization of spring-boot-autoconfigure.
Spring Boot 4 JPA module split — class relocations that need ChangeType coverage
Spring Boot 4.0 introduced three new dedicated modules (spring-boot-jpa, spring-boot-hibernate, spring-boot-persistence), relocating the following classes:
| Class | Old package (Boot 3.x) | New package (Boot 4.x) |
|---|---|---|
EntityManagerFactoryBuilder |
org.springframework.boot.orm.jpa |
org.springframework.boot.jpa |
JpaProperties |
org.springframework.boot.autoconfigure.orm.jpa |
org.springframework.boot.jpa.autoconfigure |
JpaBaseConfiguration |
org.springframework.boot.autoconfigure.orm.jpa |
org.springframework.boot.jpa.autoconfigure |
EntityManagerFactoryBuilderCustomizer |
org.springframework.boot.autoconfigure.orm.jpa |
org.springframework.boot.jpa.autoconfigure |
HibernateProperties |
org.springframework.boot.autoconfigure.orm.jpa |
org.springframework.boot.hibernate.autoconfigure |
HibernatePropertiesCustomizer |
org.springframework.boot.autoconfigure.orm.jpa |
org.springframework.boot.hibernate.autoconfigure |
SpringImplicitNamingStrategy |
org.springframework.boot.orm.jpa.hibernate |
org.springframework.boot.hibernate |
@EntityScan / EntityScanner |
org.springframework.boot.autoconfigure.domain |
org.springframework.boot.persistence.autoconfigure |
Spring Data Commons 4.0 — class relocation
| Class | Old package (SD 3.x) | New package (SD 4.x) |
|---|---|---|
PropertyPath |
org.springframework.data.mapping |
org.springframework.data.core |
Spring Data JPA 4.0 API changes that need recipe coverage
Beyond package moves, the following breaking API changes in Spring Data JPA 4.0 would benefit from automated migration:
Specification.where(null)removed → replace withSpecification.unrestricted()(thewhere(null)pattern was very common and is now a compile error since the@Nullableoverload was removed)ListenableFuturereturn type removed from async repository methods → replace withCompletableFuture
Proposed recipe skeleton
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.data.UpgradeSpringData_4_0
displayName: Migrate to Spring Data 4.0
description: >-
Migrate applications to Spring Data 4.0 (2025.1 release train).
Handles Spring Boot 4 JPA module class relocations, Spring Data Commons
PropertyPath move, and Spring Data JPA API breaking changes.
preconditions:
- org.openrewrite.Singleton
recipeList:
- org.openrewrite.java.spring.data.UpgradeSpringData_3_4
# Spring Boot 4 JPA module split — EntityManagerFactoryBuilder
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder
newFullyQualifiedTypeName: org.springframework.boot.jpa.EntityManagerFactoryBuilder
# JpaProperties
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.autoconfigure.orm.jpa.JpaProperties
newFullyQualifiedTypeName: org.springframework.boot.jpa.autoconfigure.JpaProperties
# JpaBaseConfiguration
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration
newFullyQualifiedTypeName: org.springframework.boot.jpa.autoconfigure.JpaBaseConfiguration
# EntityManagerFactoryBuilderCustomizer
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryBuilderCustomizer
newFullyQualifiedTypeName: org.springframework.boot.jpa.autoconfigure.EntityManagerFactoryBuilderCustomizer
# HibernateProperties
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties
newFullyQualifiedTypeName: org.springframework.boot.hibernate.autoconfigure.HibernateProperties
# HibernatePropertiesCustomizer
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer
newFullyQualifiedTypeName: org.springframework.boot.hibernate.autoconfigure.HibernatePropertiesCustomizer
# SpringImplicitNamingStrategy
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
newFullyQualifiedTypeName: org.springframework.boot.hibernate.SpringImplicitNamingStrategy
# @EntityScan
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.boot.autoconfigure.domain.EntityScan
newFullyQualifiedTypeName: org.springframework.boot.persistence.autoconfigure.EntityScan
# Spring Data Commons — PropertyPath moved to org.springframework.data.core
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.springframework.data.mapping.PropertyPath
newFullyQualifiedTypeName: org.springframework.data.core.PropertyPath
# Spring Data JPA 4.0 — ListenableFuture removed from async repository methods
- org.openrewrite.java.spring.data.MigrateListenableFutureToCompletableFuture
# Upgrade Spring Data dependencies to 4.0.x
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: org.springframework.data
artifactId: "*"
newVersion: 4.0.x
overrideManagedVersion: false
Note:
spring-boot-40-properties.ymlalready handles thespring.jpa.hibernate.naming.implicit-strategyproperty value rename — that can be left there or moved here for cohesion.
Describe alternatives you've considered
- Manual IDE find-replace: Possible but error-prone at scale; not suitable for automated CI-driven migration pipelines.
- Contributing only to the
spring-boot-40.ymlchain inline: These changes logically belong in a dedicatedspring-data-4.ymlfile, consistent with the existingspring-data-2.yml/spring-data-3.ymlpattern.
Additional context
- Spring Data 2025.1 GA was released on November 20, 2025, together with Spring Boot 4.0.0 and Spring Framework 7.0.
- Confirmed gap:
UpgradeSpringBoot_4_0inspring-boot-40.ymldoes not reference anyUpgradeSpringData_4_0step. This was verified against the currentmainbranch. - All class relocations above confirmed against the official Spring Boot 4.0/4.1 Javadoc at
https://docs.spring.io/spring-boot/api/java/. Specification.where(null)breaking change confirmed against Spring Data JPA source code diff between branches3.5.xand4.0.xon GitHub.- The existing
spring-data-3.ymlpattern (withUpgradeSpringData_3_0→UpgradeSpringData_3_4) can be used as a direct structural template.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing src/main/resources/META-INF/rewrite/spring-data-3.yml and spring-boot-40.yml, using the proposed spring-data-4.yml skeleton as the entry point. Implement the UpgradeSpringData_4_0 chain and the listed migration coverage, then verify that Spring Boot 4 upgrades include it and that the documentation lists the new recipe.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100