Skip to content

feat: add Jakarta EE Servlet 6.0 adapter module (#2998) - #3627

Open
EvanYao826 wants to merge 2 commits into
alibaba:1.8from
EvanYao826:feat/jakarta-servlet-adapter-2998-v2
Open

feat: add Jakarta EE Servlet 6.0 adapter module (#2998)#3627
EvanYao826 wants to merge 2 commits into
alibaba:1.8from
EvanYao826:feat/jakarta-servlet-adapter-2998-v2

Conversation

@EvanYao826

Copy link
Copy Markdown

Fixes #2998

Replaces #3618 (rebased onto latest 1.8 to resolve merge conflicts).

Summary

Add sentinel-web-servlet-jakarta module to support Jakarta EE Servlet 6.0 (Spring Boot 3.x, JDK 17+).

Background

Spring Boot 3.x migrated from javax.servlet to jakarta.servlet as part of the Jakarta EE 9+ transition. The existing sentinel-web-servlet module uses javax.servlet-api 3.1.0 and is incompatible with Spring Boot 3.x applications.

Changes

New module: sentinel-adapter/sentinel-web-servlet-jakarta

  • pom.xml: Maven configuration with jakarta.servlet-api 6.0.0 and Spring Boot 3.2.0 for tests
  • 10 Java source files from sentinel-web-servlet with javax.servlet to jakarta.servlet migration
    • CommonFilter, CommonTotalFilter, callback classes, config, utils

Modified: sentinel-adapter/pom.xml

  • Added module sentinel-web-servlet-jakarta (only in jdk17-plus profile)
  • Added skip.spring.v6x.test property to skip tests on JDK < 17

Compatibility

  • Jakarta EE Servlet 6.0+
  • Spring Boot 3.x
  • JDK 17+

EvanYao826 and others added 2 commits June 16, 2026 11:34
Add sentinel-web-servlet-jakarta module to support Jakarta EE Servlet
6.0 (Spring Boot 3.x, JDK 17+).

Changes:
- New module: sentinel-adapter/sentinel-web-servlet-jakarta
- All javax.servlet imports replaced with jakarta.servlet
- jakarta.servlet-api 6.0.0 (replacing javax.servlet-api 3.1.0)
- Spring Boot 3.2.0 for tests (replacing 1.5.17.RELEASE)
- Added new module to sentinel-adapter/pom.xml

Usage:
  <dependency>
    <groupId>com.alibaba.csp</groupId>
    <artifactId>sentinel-web-servlet-jakarta</artifactId>
  </dependency>

Fixes alibaba#2998
Moved sentinel-web-servlet-jakarta into a jdk17-plus profile so CI
on JDK 8 and 11 no longer fails. Set compiler source/target to 17
for the Jakarta module since Spring Boot 3.x requires JDK 17+.
@EvanYao826

Copy link
Copy Markdown
Author

Hi, gentle ping on this PR. It adds a Jakarta EE Servlet 6.0 adapter module for Sentinel, which is needed for modern Jakarta-based applications. Happy to make any adjustments. Thanks!

@oss-sentinel-ai oss-sentinel-ai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR adds a Jakarta Servlet 6.0 adapter module (sentinel-web-servlet-jakarta) as a Jakarta-import mirror of the existing javax sentinel-web-servlet adapter, enabled via a jdk17-plus Maven profile so the Java 8 build path is unaffected. The copied classes faithfully preserve the javax adapter's resource naming, callback semantics, block responses, exception tracing and entry/exit pairing. However, the new module's pom declares a parent version that does not exist on this branch, so the JDK 17 reactor build fails before compilation — this must be fixed first.

Findings

  • [Critical] sentinel-adapter/sentinel-web-servlet-jakarta/pom.xml:9 — parent version 2.0.0-alpha2-SNAPSHOT does not match the 1.8 reactor (1.8.11-SNAPSHOT via ${revision}); the JDK 17 build cannot resolve the parent.
  • [Warning] sentinel-adapter/sentinel-web-servlet-jakarta/pom.xml:17 — jakarta.servlet-api version pinned locally instead of parent dependencyManagement.
  • [Warning] sentinel-adapter/sentinel-web-servlet-jakarta/pom.xml:36 — no tests added despite test dependencies being declared and the javax sibling having solid coverage.

Suggestions

  • Change the parent version to ${revision} so the module resolves the reactor parent (com.alibaba.csp:sentinel-adapter:1.8.11-SNAPSHOT) like every sibling module.
  • Move the Jakarta Servlet API version into parent dependencyManagement to keep framework versions centrally managed.
  • Port the key javax sibling tests (resource naming, block handling, URL cleaning, origin parsing) to the new module.

Once the parent version is fixed, the module structure and the jdk17-plus profile gating look like a reasonable way to bring Jakarta/Spring Boot 3 support to the 1.8 branch.


Automated review by github-manager-bot

<parent>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-adapter</artifactId>
<version>2.0.0-alpha2-SNAPSHOT</version>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Critical] The parent version 2.0.0-alpha2-SNAPSHOT does not match this branch's reactor version (1.8.11-SNAPSHOT, managed via ${revision}). Maven cannot resolve com.alibaba.csp:sentinel-adapter:2.0.0-alpha2-SNAPSHOT from remote repositories, so the jdk17-plus build fails before compilation. Please use ${revision} here (all sibling modules do, e.g. sentinel-web-servlet/pom.xml).

<description>Sentinel adapter for Jakarta EE Servlet 6.0 (Spring Boot 3.x)</description>

<properties>
<jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Warning] jakarta.servlet-api version is pinned locally in the module. Project convention is to keep framework versions in the parent dependencyManagement — consider declaring the version in sentinel-adapter/pom.xml (or root) dependencyManagement and omitting it here.

<scope>provided</scope>
</dependency>

<dependency>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Warning] Test dependencies (junit, spring-boot-starter-test) are declared, but the module adds no tests, while the javax sibling sentinel-web-servlet covers resource naming, blocking behavior, URL cleaning and origin parsing. Please port at least the core filter tests (and note the skip.spring.v6x.test flag currently defaults to false, so the build will run whatever exists).

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.

Add support for Jakarta EE Servlet in adapter modules

2 participants