Skip to content

feat: add Spring 6 REST adapter artifact#16394

Draft
SavitarC wants to merge 3 commits into
apache:3.3from
SavitarC:agent/fix-dubbo-rest-spring6
Draft

feat: add Spring 6 REST adapter artifact#16394
SavitarC wants to merge 3 commits into
apache:3.3from
SavitarC:agent/fix-dubbo-rest-spring6

Conversation

@SavitarC

@SavitarC SavitarC commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What changed

  • add a Java 17 dubbo-rest-spring6 artifact backed by Spring 6 and the Jakarta Servlet API
  • preserve the legacy dubbo-rest-spring artifact for Spring 5 and the javax Servlet API
  • keep the existing REST Spring public FQCNs and SPI registrations in the parallel artifact
  • remove the legacy REST Spring adapter from the dubbo and dubbo-all-shaded aggregate JARs
  • fail fast when both REST Spring adapters are present on the runtime classpath
  • add API-parity, servlet-namespace, behavior, dependency-composition, and cross-artifact isolation tests
  • make Spring 6 status handling race-free and keep incremental JAR packaging deterministic

Why

dubbo-rest-spring is compiled against Spring 5 and javax.servlet. Spring Framework 6 changed the relevant MVC method descriptors to jakarta.servlet, so the legacy adapter cannot be used on that path without breaking Spring 5 compatibility.

A separate artifact keeps the Spring 5 contract intact while providing a Jakarta-compatible integration for Spring Framework 6+. Because the two artifacts intentionally expose the same extension FQCNs, they must never be present on the same runtime classpath.

Fixes #16387.

Dependency changes

  • The shared dubbo-spring-boot-starter remains unchanged and continues to provide the common Spring Boot autoconfiguration.
  • The dubbo and dubbo-all-shaded aggregate JARs no longer bundle dubbo-rest-spring.
  • Neither dubbo-spring-boot-autoconfigure nor dubbo-spring-boot-3-autoconfigure selects a REST Spring adapter transitively.
  • Applications using Triple REST with Spring MVC annotations must explicitly select exactly one adapter.

Migration

Applications that do not use the REST Spring integration do not need either adapter.

Spring Boot 2 / Spring Framework 5

Keep the shared starter and add dubbo-rest-spring explicitly:

<dependency>
  <groupId>org.apache.dubbo</groupId>
  <artifactId>dubbo-spring-boot-starter</artifactId>
  <version>${dubbo.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.dubbo</groupId>
  <artifactId>dubbo-rest-spring</artifactId>
  <version>${dubbo.version}</version>
</dependency>

Spring Boot 3 / Spring Framework 6

Keep the shared starter, add the Boot 3 autoconfiguration, and select dubbo-rest-spring6:

<dependency>
  <groupId>org.apache.dubbo</groupId>
  <artifactId>dubbo-spring-boot-starter</artifactId>
  <version>${dubbo.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.dubbo</groupId>
  <artifactId>dubbo-spring-boot-3-autoconfigure</artifactId>
  <version>${dubbo.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.dubbo</groupId>
  <artifactId>dubbo-rest-spring6</artifactId>
  <version>${dubbo.version}</version>
</dependency>

When the Dubbo BOM manages these artifacts, the individual <version> elements may be omitted. Applications depending directly on the dubbo aggregate artifact must follow the same explicit adapter selection rule. Remove the other adapter if it is already declared; startup now fails with the conflicting resource locations when both are present.

Validation

  • full 85-module dependency-composition reactor passed
  • Spring Boot 2 and Spring Boot 3 classpath tests each confirm exactly one matching adapter and the expected javax/jakarta activation gate
  • legacy Spring 5 contract tests, Spring 6 adapter tests, and Triple REST tests passed
  • RestSpringArtifactIsolationTest: 3/3 passed; FileTest: 8/8 passed
  • both aggregate binary and source JARs contain zero REST Spring adapter marker entries
  • two consecutive Spring 6 adapter packages produced the same SHA-256
  • git diff --check passed

@codecov-commenter

codecov-commenter commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.93478% with 315 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.78%. Comparing base (eb1d8ab) to head (62c481b).

Files with missing lines Patch % Lines
.../rest/support/spring/SpringResponseRestFilter.java 20.43% 71 Missing and 3 partials ⚠️
...support/spring/MatrixVariableArgumentResolver.java 4.00% 48 Missing ⚠️
...upport/spring/SpringMvcRequestMappingResolver.java 53.24% 26 Missing and 10 partials ⚠️
...col/tri/rest/support/spring/SpringRestToolKit.java 54.54% 19 Missing and 6 partials ⚠️
...st/support/spring/CookieValueArgumentResolver.java 9.09% 20 Missing ⚠️
...st/support/spring/RequestBodyArgumentResolver.java 25.00% 14 Missing and 1 partial ⚠️
...t/support/spring/PathVariableArgumentResolver.java 12.50% 14 Missing ⚠️
...ol/tri/rest/support/spring/BeanArgumentBinder.java 63.63% 8 Missing and 4 partials ⚠️
...st/support/spring/RequestPartArgumentResolver.java 14.28% 12 Missing ⚠️
...rest/support/spring/HandlerInterceptorAdapter.java 66.66% 11 Missing ⚠️
... and 10 more
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16394      +/-   ##
============================================
- Coverage     60.90%   58.78%   -2.12%     
+ Complexity    11763      167   -11596     
============================================
  Files          1953     1977      +24     
  Lines         89266    89818     +552     
  Branches      13471    13562      +91     
============================================
- Hits          54367    52803    -1564     
- Misses        29319    31277    +1958     
- Partials       5580     5738     +158     
Flag Coverage Δ
integration-tests-java21 ?
integration-tests-java8 ?
samples-tests-java21 ?
samples-tests-java8 ?
unit-tests-java11 59.13% <75.00%> (+0.01%) ⬆️
unit-tests-java17 58.49% <42.75%> (-0.07%) ⬇️
unit-tests-java21 58.49% <42.75%> (-0.09%) ⬇️
unit-tests-java25 58.46% <42.75%> (-0.09%) ⬇️
unit-tests-java8 59.16% <81.25%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] dubbo-rest-spring is incompatible with Spring Framework 6+ due to a javax/jakarta Servlet API mismatch

2 participants