Skip to content

fix: Switch JDK version to 17#234

Merged
hexqi merged 9 commits intodevelopfrom
release/v1.0.1-alpha.1
May 28, 2025
Merged

fix: Switch JDK version to 17#234
hexqi merged 9 commits intodevelopfrom
release/v1.0.1-alpha.1

Conversation

@lu-yg
Copy link
Collaborator

@lu-yg lu-yg commented May 28, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Chores
    • Updated Java version to 17 and upgraded Spring Boot to 3.1.9 for improved compatibility and security.
    • Updated project dependencies and build tools for better performance and support.
    • Adjusted validation and servlet imports to use Jakarta packages for alignment with newer Java standards.
  • Tests
    • Renamed and updated a test case for improved accuracy and clarity.

@coderabbitai
Copy link

coderabbitai bot commented May 28, 2025

Walkthrough

The changes update the project from Java 8 and Spring Boot 2.x to Java 17 and Spring Boot 3.1.9. All relevant imports for servlet and validation annotations are migrated from javax.* to jakarta.*. The Maven configuration, GitHub Actions workflow, and related dependencies are updated to match the new Java and Jakarta EE standards. Some controller and test method names are also updated for clarity and consistency.

Changes

File(s) Change Summary
.github/workflows/checkstyle.yml Updated GitHub Actions workflow to use JDK 17 instead of JDK 8.
pom.xml Upgraded Spring Boot to 3.1.9, Java to 17, Maven compiler plugin, and added Jakarta Servlet API and Mockito Inline.
app/src/main/java/com/tinyengine/it/config/filter/RequestIdFilter.java Migrated imports and interface from javax.servlet to jakarta.servlet, removed init(FilterConfig) method.
base/src/main/java/com/tinyengine/it/common/exception/GlobalExceptionAdvice.java Changed import of HttpServletRequest from javax.servlet to jakarta.servlet.
base/src/main/java/com/tinyengine/it/controller/*Controller.java Changed import of @Valid annotation from javax.validation.Valid to jakarta.validation.Valid.
base/src/main/java/com/tinyengine/it/controller/I18nEntryController.java Changed @Valid import, updated Javadoc and annotation description for a method.
base/src/test/java/com/tinyengine/it/controller/I18nEntryControllerTest.java Renamed test method and updated mock/service calls to match new controller method signature.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Controller
    participant Service

    User->>Controller: HTTP Request (with @jakarta.validation.Valid)
    Controller->>Service: Delegate business logic
    Service-->>Controller: Return result
    Controller-->>User: HTTP Response
Loading

Poem

🐇
Java’s cloak is now brand new,
From eight to seventeen we flew!
Jakarta’s name in every place,
Spring Boot’s fresh and full of grace.
Controllers, filters, all in line—
The engine hums, the code will shine!
Hoppily onward, upgrade time!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25ffb78 and d1c3164.

📒 Files selected for processing (19)
  • .github/workflows/checkstyle.yml (1 hunks)
  • app/src/main/java/com/tinyengine/it/config/filter/RequestIdFilter.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/common/exception/GlobalExceptionAdvice.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/AppController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/AppExtensionController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/BlockController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/BlockGroupController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/ComponentController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/ComponentLibraryController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/DataSourceController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/I18nEntryController.java (3 hunks)
  • base/src/main/java/com/tinyengine/it/controller/MaterialController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/PageController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/PageHistoryController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/PageTemplateController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/PlatformController.java (1 hunks)
  • base/src/main/java/com/tinyengine/it/controller/PlatformHistoryController.java (1 hunks)
  • base/src/test/java/com/tinyengine/it/controller/I18nEntryControllerTest.java (1 hunks)
  • pom.xml (6 hunks)
🔇 Additional comments (26)
pom.xml (6)

13-13: LGTM: Spring Boot version upgrade is appropriate.

The upgrade from 2.7.18 to 3.1.9 is a major version jump that requires Java 17+ and includes the migration to Jakarta EE 9+. This aligns with the PR objective to switch to JDK 17.


22-22: LGTM: Java version update is correct.

The update from Java 1.8 to 17 is required for Spring Boot 3.x compatibility and aligns with the PR objective.


113-118: LGTM: Jakarta servlet API dependency is appropriate.

Adding the jakarta.servlet-api dependency with provided scope is correct for the migration from javax to jakarta namespaces in Spring Boot 3.x.


134-134: LGTM: Explicit version for mockito-inline is good practice.

Making the version explicit using the property ensures consistency and easier maintenance.


170-173: LGTM: Maven compiler plugin upgrade is appropriate.

The upgrade to version 3.11.0 with Java 17 source and target is correct for Java 17 compatibility.


34-35:

Details

✅ Verification successful

Verify dependency versions for compatibility and security.

The new version properties should be verified for compatibility with Spring Boot 3.1.9 and checked for security vulnerabilities.


🏁 Script executed:

#!/bin/bash
# Description: Check for security advisories and compatibility of the specified dependency versions

echo "Checking mockito-inline 4.11.0 compatibility with Spring Boot 3.1.9..."
curl -s "https://search.maven.org/solrsearch/select?q=g:org.mockito+AND+a:mockito-inline+AND+v:4.11.0" | jq '.response.numFound'

echo "Checking jakarta.servlet-api 6.1.0 compatibility..."
curl -s "https://search.maven.org/solrsearch/select?q=g:jakarta.servlet+AND+a:jakarta.servlet-api+AND+v:6.1.0" | jq '.response.numFound'

# Check for known vulnerabilities
echo "Checking for security advisories..."
gh api graphql -f query='
{
  securityVulnerabilities(first: 10, ecosystem: MAVEN) {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      package {
        name
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

Length of output: 3859


🏁 Script executed:

#!/bin/bash
# Targeted OSV checks for specific dependencies

echo "Checking OSV for org.mockito:mockito-inline 4.11.0..."
curl -s -X POST https://api.osv.dev/v1/query \
  -H "Content-Type: application/json" \
  -d '{
    "version": "4.11.0",
    "package": {
      "name": "org.mockito:mockito-inline",
      "ecosystem": "MAVEN"
    }
  }' | jq

echo "Checking OSV for jakarta.servlet:jakarta.servlet-api 6.1.0..."
curl -s -X POST https://api.osv.dev/v1/query \
  -H "Content-Type: application/json" \
  -d '{
    "version": "6.1.0",
    "package": {
      "name": "jakarta.servlet:jakarta.servlet-api",
      "ecosystem": "MAVEN"
    }
  }' | jq

Length of output: 795


🏁 Script executed:

#!/bin/bash
# Retry OSV queries with corrected ecosystem identifier

echo "Checking OSV for org.mockito:mockito-inline 4.11.0 (ecosystem: Maven)..."
curl -s -X POST https://api.osv.dev/v1/query \
  -H "Content-Type: application/json" \
  -d '{
    "version": "4.11.0",
    "package": {
      "name": "org.mockito:mockito-inline",
      "ecosystem": "Maven"
    }
  }' | jq

echo "Checking OSV for jakarta.servlet:jakarta.servlet-api 6.1.0 (ecosystem: Maven)..."
curl -s -X POST https://api.osv.dev/v1/query \
  -H "Content-Type: application/json" \
  -d '{
    "version": "6.1.0",
    "package": {
      "name": "jakarta.servlet:jakarta.servlet-api",
      "ecosystem": "Maven"
    }
  }' | jq

Length of output: 775


🏁 Script executed:

#!/bin/bash
# Fetch Spring Boot 3.1.9 BOM POM and extract default versions for mockito and Jakarta Servlet API
POM_URL="https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/3.1.9/spring-boot-dependencies-3.1.9.pom"

echo "Inspecting BOM properties:"
curl -s "$POM_URL" \
  | sed -n '1,200p' \
  | grep -E '<mockito.version>|<jakarta.servlet-api.version>' -A1

Length of output: 496


No known compatibility or security issues detected for mockito-inline 4.11.0 and jakarta.servlet-api 6.1.0

  • Both artifacts resolve in Maven Central (mockito-inline 4.11.0 and jakarta.servlet-api 6.1.0 exist).
  • No known vulnerabilities reported in OSV for these exact versions.
  • Spring Boot 3.1.9 BOM defaults to <mockito.version>5.3.1</mockito.version>. You’re overriding it to 4.11.0 (an older release) – this is safe but you may choose to align with the BOM default for newer features and fixes.
  • The Jakarta Servlet API is provided by your runtime (no direct BOM override in 3.1.9), and 6.1.0 is compatible with Spring Boot 3.x.

Proceed with these versions or optionally bump Mockito to 5.3.1 to match the Spring Boot BOM.

base/src/main/java/com/tinyengine/it/controller/AppController.java (1)

26-26: LGTM: Correct javax to jakarta namespace migration.

The import update from javax.validation.Valid to jakarta.validation.Valid is required for Spring Boot 3.x compatibility and aligns with the Jakarta EE 9+ migration.

base/src/main/java/com/tinyengine/it/controller/AppExtensionController.java (1)

26-26: LGTM: Consistent javax to jakarta namespace migration.

The import update from javax.validation.Valid to jakarta.validation.Valid is correct and consistent with the Jakarta EE 9+ migration required for Spring Boot 3.x.

base/src/main/java/com/tinyengine/it/controller/BlockController.java (1)

36-36: LGTM: Complete javax to jakarta namespace migration.

The import update from javax.validation.Valid to jakarta.validation.Valid correctly completes the Jakarta EE 9+ migration across all controller files, ensuring consistency with Spring Boot 3.x requirements.

base/src/main/java/com/tinyengine/it/controller/ComponentController.java (1)

30-30: LGTM! Necessary Jakarta EE migration.

The import statement has been correctly updated from javax.validation.Valid to jakarta.validation.Valid, which is required for compatibility with Spring Boot 3.x and Java 17. This change maintains the same functionality while using the updated Jakarta EE namespace.

base/src/main/java/com/tinyengine/it/controller/PageTemplateController.java (1)

26-26: LGTM! Consistent Jakarta EE migration.

The validation import has been properly updated to use the Jakarta namespace, maintaining consistency with the overall Spring Boot 3.x migration strategy.

base/src/main/java/com/tinyengine/it/controller/PageHistoryController.java (1)

29-29: LGTM! Jakarta EE namespace migration completed.

The import statement has been correctly migrated to use jakarta.validation.Valid, ensuring compatibility with the updated Spring Boot 3.x framework.

base/src/main/java/com/tinyengine/it/controller/DataSourceController.java (1)

26-26: LGTM! Migration pattern completed consistently.

The final validation import has been updated to the Jakarta namespace, completing the consistent migration pattern across all controller files. This ensures full compatibility with Java 17 and Spring Boot 3.x.

base/src/main/java/com/tinyengine/it/controller/BlockGroupController.java (1)

28-28:

Details

✅ Verification successful

LGTM! Correct Jakarta EE migration.

The import update from javax.validation.Valid to jakarta.validation.Valid is correct and necessary for Spring Boot 3.x compatibility. The @Valid annotation usage in the controller methods remains proper.

Let's verify that this migration has been applied consistently across the entire codebase:


🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining javax.validation imports that need migration
# Expected: No results, indicating complete migration

echo "Checking for remaining javax.validation imports..."
rg "import javax\.validation\." --type java

echo -e "\nChecking for other potential javax imports that might need migration..."
rg "import javax\." --type java -A 1 | grep -v "servlet\|persistence\|sql\|crypto\|net\|xml\|swing\|sound" | head -20

echo -e "\nVerifying jakarta.validation imports are in place..."
rg "import jakarta\.validation\." --type java | wc -l

Length of output: 615


Migration Verified: No Remaining javax.validation Imports

  • rg "import javax\.validation\." found 0 occurrences.
  • rg "import jakarta\.validation\." reports 14 imports.

The Jakarta EE migration is consistent across the codebase. Approving the change.

base/src/main/java/com/tinyengine/it/controller/MaterialController.java (1)

25-25: LGTM! Consistent Jakarta EE migration.

The import update from javax.validation.Valid to jakarta.validation.Valid is correctly applied, maintaining consistency with the Spring Boot 3.x migration pattern.

base/src/main/java/com/tinyengine/it/controller/PlatformController.java (1)

25-25: LGTM! Proper validation import migration.

The import change to jakarta.validation.Valid is correctly implemented and aligns with the project's Jakarta EE migration strategy.

base/src/main/java/com/tinyengine/it/controller/PageController.java (1)

29-29: LGTM! Migration completed correctly.

The Jakarta EE import migration is properly implemented. The @Valid annotation continues to function correctly with the new jakarta.validation.Valid import.

base/src/main/java/com/tinyengine/it/controller/PlatformHistoryController.java (1)

25-25: Correct migration to Jakarta EE namespace.

The import change from javax.validation.Valid to jakarta.validation.Valid is necessary and correct for Spring Boot 3 compatibility. This aligns with the Jakarta EE 9+ specification where javax.* packages were moved to jakarta.*.

.github/workflows/checkstyle.yml (1)

21-24: Correct Java version update for CI/CD pipeline.

The update to JDK 17 in the GitHub Actions workflow is necessary and correct for the Spring Boot 3 migration, as Spring Boot 3.x requires Java 17 as the minimum version. The use of 'temurin' distribution is a good choice.

base/src/main/java/com/tinyengine/it/common/exception/GlobalExceptionAdvice.java (1)

17-17: Correct migration of servlet API to Jakarta namespace.

The import change from javax.servlet.http.HttpServletRequest to jakarta.servlet.http.HttpServletRequest is necessary and correct for Spring Boot 3 compatibility. This aligns with the Jakarta EE 9+ specification where servlet APIs were moved to the jakarta.* namespace.

base/src/main/java/com/tinyengine/it/controller/ComponentLibraryController.java (1)

25-25:

Details

✅ Verification successful

Correct and consistent migration to Jakarta EE namespace.

The import change from javax.validation.Valid to jakarta.validation.Valid is necessary and correct for Spring Boot 3 compatibility. This change is consistent with similar updates across other controller classes mentioned in the AI summary.

Let's verify that all similar javax.* imports have been consistently updated across the codebase:


🏁 Script executed:

#!/bin/bash
# Description: Check for any remaining javax.validation or javax.servlet imports that should be migrated
# Expected: No remaining javax.validation.Valid or javax.servlet imports in Java files

echo "Checking for remaining javax.validation imports:"
rg "import javax\.validation\." --type java

echo -e "\nChecking for remaining javax.servlet imports:"  
rg "import javax\.servlet\." --type java

echo -e "\nVerifying jakarta imports are present:"
rg "import jakarta\.(validation|servlet)\." --type java -A 1

Length of output: 3822


All javax imports successfully migrated

Verified that there are no remaining javax.validation.* or javax.servlet.* imports and all controllers and filters now use the jakarta.* namespace:

• No hits for import javax.validation. in Java files
• No hits for import javax.servlet. in Java files
• Multiple import jakarta.validation.Valid across all controllers
• Servlet filters and exception handlers use jakarta.servlet.* and jakarta.servlet.http.*

No further changes are needed.

base/src/main/java/com/tinyengine/it/controller/I18nEntryController.java (2)

72-72: Improved documentation clarity.

The updates to both the Javadoc comment and SystemControllerLog annotation make the method's purpose clearer by specifying it retrieves internationalization entries "by app" rather than "all entries."

Also applies to: 81-81


35-35:

Details

✅ Verification successful

LGTM: Jakarta validation import correctly updated.

The migration from javax.validation.Valid to jakarta.validation.Valid is correct and aligns with the Spring Boot 3.x and Jakarta EE 9+ requirements.

Let me verify that this migration has been applied consistently across the entire codebase:


🏁 Script executed:

#!/bin/bash
# Description: Verify all javax.validation imports have been migrated to jakarta.validation

# Search for any remaining javax.validation imports
echo "Checking for remaining javax.validation imports:"
rg "import javax\.validation\." --type java

echo -e "\nChecking for jakarta.validation imports:"
rg "import jakarta\.validation\." --type java -A 1

echo -e "\nVerifying @Valid annotation usage patterns:"
rg "@Valid" --type java -B 1 -A 1

Length of output: 16721


All javax.validation imports successfully migrated to jakarta.validation.Valid

• No import javax.validation.* remains in the codebase
• Every controller now uses import jakarta.validation.Valid (e.g., I18nEntryController, ComponentController, PageController, etc.)
@Valid annotation usage is correctly paired with @Validated

LGTM—ready to merge.

base/src/test/java/com/tinyengine/it/controller/I18nEntryControllerTest.java (1)

61-68: Test correctly updated to match controller changes.

The test method has been properly updated to reflect the controller changes:

  • Method name changed to testGetI18nEntriesByApp
  • Service mock updated to use findI18nEntryByApp(anyInt(), anyString())
  • Test parameters correctly set (host = 1, hostType = "app")

These changes align perfectly with the controller method signature and functionality.

app/src/main/java/com/tinyengine/it/config/filter/RequestIdFilter.java (2)

29-29: Filter interface correctly updated.

The class now properly implements jakarta.servlet.Filter instead of the legacy javax.servlet.Filter, ensuring compatibility with Jakarta EE 9+ and Spring Boot 3.x.


15-18:

Details

✅ Verification successful

LGTM: Jakarta servlet imports correctly updated.

All servlet imports have been properly migrated from javax.servlet.* to jakarta.servlet.*, which is required for Spring Boot 3.x compatibility.

Let me verify that the servlet migration has been applied consistently across the entire codebase:


🏁 Script executed:

#!/bin/bash
# Description: Verify all javax.servlet imports have been migrated to jakarta.servlet

# Search for any remaining javax.servlet imports
echo "Checking for remaining javax.servlet imports:"
rg "import javax\.servlet\." --type java

echo -e "\nChecking for jakarta.servlet imports:"
rg "import jakarta\.servlet\." --type java -A 1

echo -e "\nVerifying HttpServletRequest/Response usage:"
rg "HttpServletRequest|HttpServletResponse" --type java -B 1 -A 1

Length of output: 2014


All Jakarta servlet imports successfully migrated

  • No remaining javax.servlet.* imports found across the codebase.
  • Confirmed jakarta.servlet.* imports in app/src/main/java/com/tinyengine/it/config/filter/RequestIdFilter.java and base/src/main/java/com/tinyengine/it/common/exception/GlobalExceptionAdvice.java.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information

@hexqi hexqi merged commit 07dab03 into develop May 28, 2025
1 check passed
lu-yg added a commit to lu-yg/tiny-engine-backend-java that referenced this pull request Oct 23, 2025
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.

2 participants