feat: add Jakarta EE Servlet 6.0 adapter module (#2998) - #3627
feat: add Jakarta EE Servlet 6.0 adapter module (#2998)#3627EvanYao826 wants to merge 2 commits into
Conversation
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+.
|
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
left a comment
There was a problem hiding this comment.
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-SNAPSHOTdoes not match the 1.8 reactor (1.8.11-SNAPSHOTvia${revision}); the JDK 17 build cannot resolve the parent. - [Warning] sentinel-adapter/sentinel-web-servlet-jakarta/pom.xml:17 —
jakarta.servlet-apiversion pinned locally instead of parentdependencyManagement. - [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
dependencyManagementto 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> |
There was a problem hiding this comment.
[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> |
There was a problem hiding this comment.
[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> |
There was a problem hiding this comment.
[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).
Fixes #2998
Replaces #3618 (rebased onto latest
1.8to 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
Modified: sentinel-adapter/pom.xml
skip.spring.v6x.testproperty to skip tests on JDK < 17Compatibility