openrewrite / openrewrite/rewrite-spring

[Tracking] Add Spring Data MongoDB 5.0 migration support

Open
#1,081 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

recipe
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

Related work

  • #1080 introduces the datastore-neutral spring-data-4.yml and UpgradeSpringData_4_0 foundation.
  • #1063 tracks the broader Spring Data 2025.1 / JPA-oriented migration request.
  • #1079 covers Spring Boot-owned MongoDB modular package moves and dedicated MongoDB test starters.

What problem are you trying to solve?

Spring Boot 4 uses the Spring Data 2025.1 release train, which includes Spring Data MongoDB 5.0. rewrite-spring does not yet provide focused migration support for the Spring Data MongoDB 4.x to 5.x changes.

Spring Data support in rewrite-spring is incremental and does not need to cover every datastore before UpgradeSpringData_4_0 becomes useful. This issue tracks the MongoDB workstream because MongoDB has confirmed migration requirements and concrete user demand.

The common Spring Data 4 YAML and public composite belong to #1080. This issue owns the MongoDB roadmap, sequencing, and integration status; implementation details and acceptance criteria are owned by the linked child issues below.

Proposed structure

Once #1080 provides the common extension point, introduce a MongoDB-specific composite such as:

org.openrewrite.java.spring.data.MigrateSpringDataMongoDb5

and compose it into:

org.openrewrite.java.spring.data.UpgradeSpringData_4_0

Each confirmed MongoDB migration concern should remain independently implementable and reviewable. Completed child recipes should be appended to the MongoDB sub-composite so that UpgradeSpringData_4_0 improves incrementally.

Child implementation issues

The proposed work in this tracking issue will be delivered through these child issues:

  • #1082 — Add the MongoDB 5 migration composite and dependency alignment.
  • #1083 — Detect missing explicit UUID and large-number representation configuration.
  • #1084 — Preserve or report changed DefaultMessageListenerContainer startup behaviour.
  • #1085 — Detect removed Spring Data MongoDB JMX support.
  • #1092 — Replace removed MongoDB Java Driver uber JAR dependencies safely.
  • #1093 — Migrate direct MongoDB legacy API usage to the current synchronous API where safe.

Each child issue owns its detailed scope, implementation approach, tests, and acceptance criteria. This parent issue should be updated with the corresponding PR links and completion status rather than duplicating those details here.

Order of implementation

  1. Complete the common Spring Data 4 foundation in #1080.
  2. Implement #1082 to establish the MongoDB 5 sub-composite and its initial dependency behaviour.
  3. Implement #1083, #1084, and #1085 independently as demand and confidence permit.
  4. Implement #1092 and #1093 as separately reviewable driver dependency and source migrations, preserving diagnostics for ambiguous cases.
  5. Compose each completed recipe or diagnostic into the MongoDB sub-composite.
  6. Close this tracking issue when the planned children are completed or explicitly deferred with rationale.

Out of scope

This tracking issue should not own:

  • Creation of spring-data-4.yml or the top-level UpgradeSpringData_4_0 foundation; see #1080.
  • Spring Data Commons or Spring Data JPA migrations.
  • Migrations for other Spring Data datastores unless separately requested and analysed.
  • Spring Boot MongoDB auto-configuration, Actuator package, or starter migrations; see #1079.
  • Generated Spring Boot configuration-property migration that is already covered by the Boot 4 property recipes.
  • A blanket org.springframework.data:* upgrade to 4.0.x, because the Spring Data 2025.1 release train contains datastore modules on different major versions.
  • General MongoDB Java Driver migration for applications that do not use Spring Data MongoDB.
  • Kotlin or Scala MongoDB driver migrations.

Tracking acceptance criteria

  • #1080 provides the common Spring Data 4 extension point.
  • MongoDB-specific work is represented by a named sub-composite under UpgradeSpringData_4_0.
  • Each completed child recipe or diagnostic is integrated into that sub-composite.
  • Child issues and implementation PRs remain linked from this tracker.
  • Any deferred child is documented with rationale before this issue is closed.

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with #1080 and the child issues #1082–#1085, #1092, and #1093; each child owns its implementation details, tests, and acceptance criteria. Review the Spring Data MongoDB 4.x-to-5.x migration guide and track the named sub-composite under UpgradeSpringData_4_0. Done means completed child work is integrated, links are current, and deferred items have documented rationale.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mongodb, spring
Domain
backend, databases, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.