Skip to content

feat: add Spring 6 REST adapter artifact - #16394

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

feat: add Spring 6 REST adapter artifact#16394
SavitarC wants to merge 4 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 by copying the legacy REST Spring adapter and applying only the Spring 6 / Jakarta Servlet compile-time adaptations
  • preserve the legacy dubbo-rest-spring artifact and its Spring 5 / javax.servlet runtime behavior
  • keep the existing REST Spring public FQCNs and SPI registrations in the parallel artifact
  • register the new module in the root JDK 17 profile, release profile, BOM, and .artifacts
  • remove dubbo-rest-spring from the dubbo and dubbo-all-shaded aggregate JARs so neither aggregate chooses an adapter
  • keep per-artifact marker resources for a future classpath checker; this PR does not consume them at runtime
  • add Spring 5/6 API parity, servlet namespace, Boot 2/3 dependency composition, basic @RequestMapping end-to-end, and Spring 6.1 compatibility coverage
  • register dubbo-test-rest-spring6.1 under the JDK 17+ test profile

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 artifact cannot support that path without breaking Spring 5 compatibility.

A separate artifact keeps the Spring 5 contract unchanged while providing a Spring 6 / Jakarta-compatible implementation.

Fixes #16387.

Dependency selection

Applications using Triple REST with Spring MVC annotations must explicitly select exactly one adapter. Applications that do not use the REST Spring integration may include neither.

Spring Boot 2 / Spring Framework 5

<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

<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.

Having both REST Spring adapters on one classpath is an unsupported configuration. This version does not provide runtime conflict detection; users must ensure the classpath contains at most one adapter.

Scope

This PR is limited to the Spring 6 artifact split, build/distribution metadata, marker resources, and the tests needed to validate that split. It intentionally does not include:

  • FrameworkModel initialization rollback or cleanup changes
  • REST adapter classpath fail-fast logic
  • shared Triple REST filter lifecycle changes
  • JAX-RS exception mapper changes
  • legacy Spring adapter interceptor or exception-handler behavior changes
  • shared mapping semantics, Spring MVC behavior alignment, parameter binding, or CORS fixes

Validation

  • JDK 8: dubbo-rest-spring 58 tests, 11 skipped, 0 failures
  • JDK 25: dubbo-rest-spring6 52 tests, 0 failures
  • Spring 6.1 @RequestMapping compatibility: 1 test, 0 failures
  • dependency/distribution FileTest: 8 tests, 0 failures
  • Boot 2 and Boot 3 composition tests each find exactly one matching adapter and marker
  • dubbo and dubbo-all-shaded binary/source JARs contain neither REST Spring adapter
  • CI unit tests pass on JDK 8, 11, 17, 21, and 25; all integration-test jobs pass
  • cross-repository Java 21 validation against fix: select Spring 6 REST adapter for samples dubbo-samples#1297 (23cd268bb1) with -Ddubbo.version=3.3.7-SNAPSHOT -Dspring.version=6.1.5 -Ddubbo.rest.spring6=true:
    • dubbo-samples-triple-rest-springmvc: provider registered 48 REST mappings; all 36 ConsumerIT tests passed
    • dubbo-samples-triple-rest-spring-security: provider registered the Spring MVC REST mappings; both ResourceServerIT tests passed
  • with the sample profile disabled, the packaged sample contains neither REST Spring adapter and /demo/hello returns 404 Invoker not found, confirming the explicit-selection behavior
  • git diff --check passed

Current CI coordination

The samples jobs in this PR currently check out apache/dubbo-samples@master and do not enable -Ddubbo.rest.spring6=true. Because apache/dubbo-samples#1297 is still open and its profile is opt-in, the Java 21 samples job tests the aggregate without a REST Spring adapter and fails with 404 Invoker not found.

The cancelled samples-result job and skipped Jacoco jobs are downstream consequences of that samples failure. The adapter tests, unit tests, and integration-test jobs are green. The cross-repository check cannot become green until the samples ref/profile is available to the workflow or equivalent merge coordination is accepted.

@codecov-commenter

codecov-commenter commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.64486% with 355 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.73%. Comparing base (eb1d8ab) to head (ea51d47).

Files with missing lines Patch % Lines
.../rest/support/spring/SpringResponseRestFilter.java 8.60% 81 Missing and 4 partials ⚠️
...support/spring/MatrixVariableArgumentResolver.java 4.00% 48 Missing ⚠️
...upport/spring/SpringMvcRequestMappingResolver.java 53.24% 26 Missing and 10 partials ⚠️
...rest/support/spring/HandlerInterceptorAdapter.java 3.03% 32 Missing ⚠️
...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 ⚠️
... and 10 more
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16394      +/-   ##
============================================
- Coverage     60.90%   58.73%   -2.18%     
+ Complexity    11763      157   -11606     
============================================
  Files          1953     1976      +23     
  Lines         89266    89801     +535     
  Branches      13471    13559      +88     
============================================
- Hits          54367    52741    -1626     
- Misses        29319    31321    +2002     
- Partials       5580     5739     +159     
Flag Coverage Δ
integration-tests-java21 ?
integration-tests-java8 ?
samples-tests-java21 ?
samples-tests-java8 ?
unit-tests-java11 59.10% <ø> (-0.01%) ⬇️
unit-tests-java17 58.43% <33.64%> (-0.13%) ⬇️
unit-tests-java21 58.45% <33.64%> (-0.14%) ⬇️
unit-tests-java25 58.42% <33.64%> (-0.13%) ⬇️
unit-tests-java8 59.16% <ø> (+<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.

@SavitarC
SavitarC force-pushed the agent/fix-dubbo-rest-spring6 branch from f6f541b to ea51d47 Compare July 26, 2026 06:08
@SavitarC
SavitarC marked this pull request as ready for review July 26, 2026 10:50
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