Skip to content

Upgrade to Java 21 / Spring Boot 3.5 (revives #1185) - #1258

Open
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/task-24-revive-1185-boot-3.5
Open

devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/task-24-revive-1185-boot-3.5

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Summary

Revives keeper #1185 on a fresh branch off master (1b03279): its two commits cherry-picked unchanged, same 27 files, +151/−106. Nothing was added on top.

Before After
Spring Boot 2.6.3 3.5.16
Java 11 21 (Gradle toolchain)
Gradle wrapper 7.4 8.14.3
DGS 4.9.21 10.6.0 (graphql-dgs-spring-graphql-starter)
MyBatis starter 2.2.2 3.0.5
jjwt 0.11.2 0.12.6

Code changes are the Boot 3 mechanics: javax.* → jakarta.*, WebSecurityConfigurerAdapter → SecurityFilterChain bean, jjwt 0.12 builder/parser API in DefaultJwtService, DGS 10 exception-handler API, and a new GraphQLHttpConfig for the DGS-on-spring-graphql HTTP setup. No Flyway migration or Flyway config is touched.

#1256: both edit DefaultJwtServiceTest.java; merging #1256 into this branch is clean and ./gradlew spotlessJavaCheck build stays green on the merge (69 tests). #1256's V2__ migration is unaffected by this PR.

security/snyk: left as is per the thread; it fails on most open PRs and master has no build workflow.

Verification

  • ./gradlew spotlessJavaCheck build on Java 21: green, 68 tests, 0 failures.
  • App started with bootRun (Boot 3.5.16, Java 21, Tomcat 10.1.60, Flyway V1 applied on a fresh SQLite dev.db); a 54-step HTTP script seeding users, articles and comments passed 54/54 across REST (register/login, user get/update, profiles + follow, article CRUD, favorite, tag/author/favorited filters, feed, comments) and GraphQL (createUser incl. duplicate error union, login, me, updateUser, follow, article create/update/favorite/delete, pagination, withTag, feed, addComment/deleteComment, tags, GraphiQL). The same script passes 54/54 on master.

Replaces

Keeper #1185 itself, plus the 597 open Boot/Java/Gradle upgrade PRs Git Gossip mapped as replaced (#1197's stacked follow-ups #1188–#1196 go with #1197). Not replaced: #985, #1239, #1240, #1241 (they target base/ankehao-master). None were commented on or closed.

#3 #4 #5 #6 #7 #9 #10 #11 #12 #13 #14 #15 #16 #17 #18 #19 #20 #21 #22 #23 #24 #25 #26 #27 #28 #29 #30 #31 #32 #33 #34 #36 #37 #39 #40 #42 #43 #45 #46 #47 #48 #49 #50 #52 #53 #54 #55 #57 #58 #59 #60 #61 #62 #63 #64 #65 #66 #68 #69 #70 #71 #72 #74 #75 #76 #77 #78 #79 #80 #82 #85 #87 #88 #89 #90 #91 #92 #93 #97 #98 #99 #100 #101 #102 #103 #105 #106 #107 #108 #109 #110 #111 #112 #113 #114 #115 #116 #117 #118 #119 #120 #126 #128 #129 #131 #133 #135 #136 #138 #140 #141 #142 #143 #144 #146 #147 #148 #150 #151 #153 #154 #155 #170 #173 #174 #177 #182 #183 #184 #185 #186 #193 #195 #196 #198 #200 #201 #203 #207 #208 #212 #214 #215 #216 #221 #222 #224 #225 #227 #229 #230 #232 #233 #234 #235 #237 #238 #239 #241 #242 #243 #246 #247 #248 #249 #250 #255 #257 #258 #259 #260 #261 #262 #265 #266 #267 #268 #269 #270 #271 #274 #278 #279 #280 #281 #282 #283 #284 #287 #288 #289 #290 #291 #292 #293 #294 #295 #296 #297 #298 #300 #303 #305 #306 #309 #310 #312 #313 #314 #315 #316 #318 #319 #321 #322 #324 #325 #326 #327 #328 #329 #331 #333 #334 #336 #338 #339 #340 #342 #343 #344 #345 #346 #347 #349 #350 #351 #354 #355 #356 #358 #359 #360 #362 #363 #364 #366 #367 #368 #374 #375 #376 #377 #378 #379 #380 #381 #382 #383 #384 #387 #388 #394 #395 #397 #398 #399 #400 #410 #412 #414 #415 #416 #417 #418 #419 #420 #421 #422 #423 #424 #425 #426 #427 #429 #431 #433 #434 #435 #437 #438 #441 #442 #444 #446 #447 #449 #465 #466 #467 #468 #469 #470 #471 #472 #473 #474 #475 #479 #481 #482 #483 #484 #485 #486 #487 #488 #489 #490 #491 #493 #496 #500 #502 #503 #504 #505 #506 #507 #508 #509 #510 #511 #515 #516 #527 #535 #538 #539 #540 #542 #544 #545 #551 #557 #559 #560 #561 #563 #565 #566 #567 #569 #571 #574 #576 #577 #578 #581 #583 #584 #585 #588 #589 #590 #591 #593 #596 #597 #598 #599 #600 #603 #604 #605 #606 #608 #610 #612 #614 #621 #623 #624 #627 #628 #629 #630 #632 #635 #637 #638 #642 #643 #644 #646 #648 #650 #651 #652 #656 #659 #662 #668 #669 #670 #673 #674 #675 #676 #677 #678 #691 #692 #699 #702 #703 #714 #716 #717 #718 #720 #721 #722 #723 #724 #726 #731 #735 #736 #737 #738 #739 #740 #741 #742 #743 #744 #745 #746 #747 #748 #749 #751 #752 #753 #765 #767 #770 #772 #775 #776 #777 #783 #784 #795 #796 #798 #803 #815 #816 #817 #826 #828 #831 #832 #836 #838 #839 #840 #841 #842 #843 #844 #845 #846 #847 #848 #849 #850 #851 #852 #853 #854 #855 #856 #860 #861 #864 #868 #880 #881 #882 #886 #887 #892 #893 #894 #895 #896 #897 #898 #899 #900 #902 #907 #909 #915 #916 #924 #925 #926 #940 #941 #942 #943 #955 #957 #965 #966 #980 #981 #982 #984 #987 #988 #989 #990 #991 #992 #994 #996 #997 #998 #1001 #1002 #1003 #1005 #1009 #1012 #1013 #1015 #1018 #1021 #1022 #1023 #1024 #1035 #1040 #1045 #1046 #1048 #1049 #1050 #1052 #1057 #1060 #1065 #1067 #1070 #1071 #1072 #1077 #1079 #1082 #1085 #1087 #1088 #1089 #1093 #1100 #1101 #1102 #1104 #1105 #1106 #1110 #1115 #1116 #1117 #1131 #1140 #1141 #1142 #1155 #1161 #1167 #1168 #1184 #1197 #1199 #1223 #1229 #1230 #1232 #1244 #1246 #1252


Migration Engineer opened this PR for Matthew
Implemented in session Upgrade RealWorld API to Spring Boot 3
Review with Devin · Open in Devin Desktop


devin-ai-integration Bot and others added 2 commits November 17, 2026 05:14
- Gradle wrapper 7.4 -> 8.14.3; Java 21 toolchain
- Spring Boot 2.6.3 -> 3.3.13, DGS 4.9 -> 9.1.3 (codegen 6.3.0), MyBatis 3.0.4, jjwt 0.12.6
- javax.* -> jakarta.* migration
- Replace WebSecurityConfigurerAdapter with SecurityFilterChain bean
- Adapt to graphql-java 22 DataFetcherExceptionHandler and Spring 6 HttpStatusCode APIs

Co-Authored-By: Bryce Hunt <bryce@cognition.ai>
Spring Boot 3.3 is out of OSS support and carried 112 known vulnerabilities.
Bump to Spring Boot 3.5.16, DGS 10.6.0 (spring-graphql starter, since the legacy
starter was removed), DGS codegen 8.7.0, MyBatis 3.0.5, and pin patched
Tomcat/Jackson/Logback/Hibernate Validator. Give the GraphQL endpoint its own
JSON converter so UNWRAP_ROOT_VALUE for the REST API does not break it.

Co-Authored-By: Bryce Hunt <bryce@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Custom reviewers

  • 🧪 Test 2 reviewer: no findings · View
  • 🚩 TD Enterprise Architecture: no findings · View
  • 👁️ TD Information Security: no findings · View
  • 🧠 TD French Language (Bill 96): no findings · View
  • ⏱️ TD API Contracts: no findings · View

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Author

I couldn't run the new tests. Gradle on this VM couldn't download the Boot 3.5, Spotless 6.25 and DGS 8.7 plugins: the Maven Central mirror and plugins-artifacts.gradle.org are blocked, and repo.maven.apache.org returned HTTP 429. Run ./gradlew spotlessJavaApply test on Java 21 before merging the test PR. The assertions most likely to need tweaking are the DGS fallback errorType (INTERNAL) and the CORS preflight status.

Test PR: #1260 (targets devin/task-24-revive-1185-boot-3.5)

Review of #1258: bugs and risks

  • The app now refuses to start with a short JWT secret. DefaultJwtService builds the key with Keys.hmacShaKeyFor, which throws WeakKeyException for any jwt.secret under 32 bytes. The old code accepted any length, so a deployment with a short secret will fail at startup.
  • The signing algorithm now depends on secret length. signWith(key) picks HS256, HS384 or HS512 from the key size; before, it was always HS512. The default 86-character secret still gives HS512, so existing tokens keep working. With a 32–63 byte secret, every token issued before the upgrade stops verifying and all users are logged out.
  • Pinned versions override Spring Boot's managed versions. ext['tomcat.version'], jackson-bom, logback and hibernate-validator are pinned, so later Boot patch upgrades won't move them. Someone has to bump them by hand.
  • The GraphQL endpoint ignores spring.jackson.* settings. GraphQLHttpConfig gives it its own plain ObjectMapper. That fixes the UNWRAP_ROOT_VALUE parsing problem, but any future Jackson setting won't apply to /graphql. This is low risk today.
  • Builds now need JDK 21. The Gradle toolchain is set to Java 21, and master has no build workflow to catch a break.

Coverage gaps filled

  • GraphQLHttpConfig (new integration test on a real port with a temp SQLite DB):
    • /graphql parses request bodies, and REST POST /users still unwraps {"user":…}.
    • A token from GraphQL createUser works on GET /user.
    • A failed login returns UNAUTHENTICATED.
  • SecurityFilterChain:
    • An anonymous request for a missing article returns 404, not 401. This checks the ERROR-dispatch permitAll.
    • Anonymous feed and write requests, and requests with a bad token, return 401.
    • Public GETs work and the CORS preflight is allowed.
  • GraphQLCustomizeExceptionHandler.handleException (unit tests): auth errors, constraint-violation errors, and fallback to the default handler.
  • DefaultJwtService on jjwt 0.12:
    • Rejects tokens signed with a different secret, tampered tokens and alg:none tokens.
    • Signs with HS512 when the secret is production length.
    • Still accepts an HS512 token issued before the upgrade.
    • Throws WeakKeyException for a short secret.

I didn't approve, merge or push anything to #1258's branch. There's nothing to UI-test because the test PR only adds test files.

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.

0 participants