Skip to content

Spring Boot 2.7 → 3.5 (Kotlin 2.2, Gradle 8.14, Hibernate 6, Security 6) - #1574

Open
fellipeale wants to merge 21 commits into
zalando:mainfrom
fellipeale:boot4/3-boot35
Open

fellipeale wants to merge 21 commits into
zalando:mainfrom
fellipeale:boot4/3-boot35

Conversation

@fellipeale

@fellipeale fellipeale commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Four stages, one commit group each (236 files). Review commit by commit; the ktlint reformat is isolated in a280692a and listed in .git-blame-ignore-revs.

0 plan       server/BOOT4_MIGRATION_PLAN.md, OpenRewrite recipes, CI runs on boot4/** PRs
1 safety net golden master of the HTTP surface, Postgres 13 + Flyway test,
             production-profile security tests, JUnit 4 and vintage engine removed
2 tooling    Gradle 8.0-rc-1 -> 8.14.6, Kotlin 1.8 -> 2.2, Dokka 2, spotless/ktlint 1.7
3 Boot 3.5   Spring Boot 2.7 -> 3.5.16

Stage 3 replaces libraries that do not exist for Boot 3:

 security
-  stups-spring-oauth2-server            (ResourceServerConfigurerAdapter)
+  SecurityFilterChain + TokenInfoOpaqueTokenIntrospector
 errors
-  problem-spring-web
+  ExceptionHandling  ({title,status,detail}, application/problem+json)
 schema discovery
-  twintip-spring-web
+  SchemaController
 persistence
-  Jadira (ApiReview.created)
+  native OffsetDateTime, hibernate.jdbc.time_zone=UTC

Evidence

  • Before (Boot 2.7.7): 1400 tests, 0 failed, 2 skipped
    After (Boot 3.5.16): 1463 tests, 0 failed, 1 skipped (the old @Disabled matcher test went away with the PathMatchersTest rewrite)

Also passing: ./gradlew build (spotless, Dokka), cli/zally/test.sh integration, Docker smoke test (Postgres 13, dev profile).

GoldenMasterTest pins 90 request/response cases from Boot 2.7. Intended differences:

Area 2.7 3.5
Trailing slash (/api-violations/, ...) 200 404 (403 in production)
No token (production) 500 401 problem+json
Valid token, path denied 500 403
Tokeninfo endpoint down (5xx, timeout) 401 503 problem+json
Framework error detail wording "...nested exception is..." shorter Spring 6 wording
detail when fetching api_definition_url fails (status unchanged) 401 Unauthorized: "<body>" while retrieving api definition url 401 Unauthorized on GET request for "<url>": "<body>" while retrieving api definition url
Order of violations with the same severity and title (e.g. the two Use Standard HTTP Status Codes rules); same violations, stable per version general rule first per-path rule first
Accept: application/yaml (the application/x-yaml type is unchanged) 406 200, application/yaml
ApiReview.created JVM-zone wall clock always UTC

Merge Danger

Door: one-way for API clients, two-way for the code.

The database schema is unchanged and no Flyway migration is added, so rolling the deployment back works. Clients that adapted to the new behaviour would not follow a rollback.

Blast Radius: API consumers

  • Clients calling a URL with a trailing slash now get 404.
  • Clients that treated 401 from tokeninfo failures as "retry login" now get 503.
  • CLI and web UI were checked (CLI integration tests pass, see the "Client compatibility" comment). Other consumers, which live outside this repo, were not.
  • ApiReview.created is now read as UTC. Existing rows are valid, but this has only been tested against Postgres 13 under four JVM time zones, not against production data.
  • The production profile was run from the packaged image against a stub tokeninfo server (see the verification comment). The real tokeninfo endpoint is untested.

🤖 Generated with Claude Code

Fellipe Alexandre and others added 21 commits October 20, 2026 16:58
Init-script based, so no build.gradle.kts changes are needed. Recipes are
untested: the dry run could not be executed in the authoring session.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… run got right

The official UpgradeSpringBoot_3_5 composite produced invalid Kotlin and broken
build files on Zally. Replace it with an explicit subset and exclude the
library modules and buildSrc.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Run CI on pull requests that target boot4/** branches so stacked PRs are checked,
and reword decision 6: stages 0-3 merge together and ship Boot 3.5, Boot 4.0 follows.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every other test uses HSQLDB. Pins the timestamp storage (including the Boot 2.7
quirk that created is written in the JVM time zone), UUID columns, the statistics
query and reading rows written by the current build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Run the app with the production profile against a stub tokeninfo endpoint and pin
the access rules as they behave on Boot 2.7, including the unexpected 500 for a
missing token. RestCorsWithOAuthTest now runs with OAuth enabled.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
82 requests covering success paths, every error type, YAML negotiation, path
suffixes, trailing slashes and the management port, plus tests that pin the error
body shape and the actuator exposure. Regenerate with GOLDEN_UPDATE=true.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…age gaps

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Replace the deprecated buildDir getter.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Library modules keep languageVersion/apiVersion 1.8 so that consumers on an older
Kotlin compiler can still read the published metadata. Dokka 2 has no dokkaJavadoc
task: the javadoc jar now uses dokkaGeneratePublicationJavadoc.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The old ktlint cannot run on Kotlin 2.2. Configure the import-ordering exemption the
ktlint 1.x way, and fix the two findings that ktlint cannot auto-fix: constant naming
in JsonSchemaValidator and a block comment in ReverseAstBuilder.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Trailing commas, blank lines and similar. No behaviour change. Listed in
.git-blame-ignore-revs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Use with: git config blame.ignoreRevsFile .git-blame-ignore-revs (GitHub reads it automatically).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… property renames)

Dry run read first. One result corrected by hand: enabled-by-default: true became
access.default: read-only, which would restrict every actuator endpoint; the equivalent
is unrestricted. The build does not compile yet, the manual steps follow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- ApiReview.created: native OffsetDateTime stored as UTC (hibernate.jdbc.time_zone=UTC) instead of
  Jadira. Unlike Boot 2.7 this no longer depends on the JVM time zone; existing rows stay valid because
  the container ran in UTC. The Postgres test now checks four JVM zones.
- ApiReviewRepository: HQL for Hibernate 6 (boolean literal, qualified property names, no aliases).
- Drop the Jackson, snakeyaml, Mockito, Flyway and driver pins in the server so Boot manages them.
  Flyway 11 needs flyway-database-postgresql and flyway-database-hsqldb.
- swagger-parser 1.0.76 constraint: 1.0.64 calls SafeConstructor() which snakeyaml 2 removed.
- zally-core: an extension method no longer appends an empty pointer segment; Jackson 2.19 keeps the
  trailing slash that 2.14 dropped.
- Remove dead legacy keys from application*.yml.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…er, MVC 6

- OAuthConfiguration/NoSecurityConfiguration as SecurityFilterChain beans with the built-in opaque
  token resource server and a TokenInfoOpaqueTokenIntrospector for the tokeninfo endpoint (public
  libraries only, replaces stups-spring-oauth2-server).
- ExceptionHandling on ResponseEntityExceptionHandler emits {title,status,detail} as
  application/problem+json, replacing problem-spring-web. Unmapped routes keep Boot's error body.
- SchemaController replaces twintip-spring-web (/api and /.well-known/schema-discovery).
- Remove favorPathExtension (decision 3); path matchers simplified to slash-less paths.
- Tests: production security tests adjusted for the announced differences, PathMatchersTest on
  PathPatternRequestMatcher, golden master regenerated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Log unexpected errors in ExceptionHandling (the catch-all swallowed them) and 5xx framework errors.
- Tokeninfo: only 400/401/403 mean a bad token. 5xx, timeouts, 404 and 429 are an outage of the endpoint and
  answer 503 (TokenInfoOutageFilter), not 401 or a bare 500. Tests with a stub that fails in each way.
- 401/403 bodies use fixed texts instead of echoing the exception message.
- Register the problem handlers once; bind the schema path to twintip.mapping; remove the dead
  @ResponseStatus; move the Jackson/snakeyaml pins of the library modules out of the zally-server special case.
- Comment on the sendError/ERROR-dispatch coupling; tidy ApiReview imports.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2.1.12 calls SafeConstructor() like io.swagger:swagger-parser 1.0.64 did, so every YAML
definition logged 'Error snake-parsing yaml content' and only worked through a fallback.
New test fails without the constraint.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fellipeale
fellipeale requested a review from tkrop as a code owner November 18, 2026 09:22
@fellipeale

Copy link
Copy Markdown
Collaborator Author

Manual verification on boot4/3-boot35

Run locally on 2026-11-18 against the PR head (d8abce0b). Docker images were built from the repo's own server/Dockerfile, so ./gradlew build with all tests ran inside the image build (passed).

Check Result
CLI integration tests (cli/zally/test.sh integration, Go 1.22, against the 3.5 server on :8000) 47 tests pass, 0 failures
Docker smoke test (Postgres 13.23) Flyway V001 to V007 migrate on an empty DB. /health is UP. POST /api-violations returns 200 and the review is read back by /review-statistics. The jar is /zally-server.jar.
Upgrade: Boot 2.7 (main image) writes 4 reviews, then the 3.5 image starts on the same DB (containers in UTC) Flyway validates the 7 existing migrations, no checksum or migration changes. All 4 reviews read back with API JSON identical to the 2.7 responses. /review-statistics identical. api_review rows unchanged (created, external_id, day, definition checksum).
Rollback: 3.5 writes a review, then the 2.7 image starts on the same DB Flyway validates. All 5 reviews return 200. The 4 original reads are identical to the first 2.7 reads.
production profile from the packaged image, stub tokeninfo server No token: 401 + WWW-Authenticate: Bearer. Valid uid token: 200 on /supported-rules, /review-statistics and POST /api-violations. Token without uid: 401. Token rejected by tokeninfo: 401. Tokeninfo returning 500: 503. Valid token on an unknown path: 403. OPTIONS without a token: 200. Management port: /health 200 without a token, /metrics 401 without and 200 with a token.

🤖 Generated with Claude Code

@fellipeale

fellipeale commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Client compatibility

The clients that live in this repo, read from source and run against the 3.5 server:

Client Calls Reads the error body? Result
CLI POST /api-violations, GET /supported-rules?is_active=true Prints status and raw body, does not parse it Unaffected, 47 CLI tests pass on 3.5
Web UI /api-violations, /api-violations/<id>, /supported-rules Yes: shows error.detail. On a 401 it refreshes the token and retries when OAuth is enabled See findings below

Neither uses trailing slashes.

Findings

  1. New difference: the detail text for failed api_definition_url fetches changed (new row in the table in the description). Status codes are identical on 2.7 and 3.5 for a successful fetch, a redirect, and a remote 401, 404 and 500. The web UI's "by URL" mode shows this text. The new text also repeats the submitted URL back to the caller.
  2. Web UI auth handling: a tokeninfo outage is now a 503 instead of a 401, so the UI no longer starts a token refresh for it. A missing token is now a 401 (was 500), so the UI refreshes the token and retries.

@fellipeale

Copy link
Copy Markdown
Collaborator Author

Lint output comparison

The 25 fixtures in server/zally-test and examples/sample_swagger_api.yaml (26 specs) were posted to /api-violations on a Boot 2.7 build and on this branch, with the same default config.

Result Specs
Identical response (violations, order, counts, pointers, line numbers, message, api_definition) 20
Same violations, different order for rules that share a title 6
Different violations, status codes or errors 0

The only difference is the order of violations that tie on severity and title: two rules both titled Use Standard HTTP Status Codes (the general "is not a well-understood response code" one and the per-path one) swap places. The order is stable on each version (three repeated runs on six specs gave one ordering each) and is probably the order in which Spring injects the rule beans. The set of violations is identical. The new row in the differences table above lists it.

Limits: 26 specs is a small sample, none of them triggered a lint error, and ignore_rules was not used.

🤖 Generated with Claude Code

@fellipeale fellipeale added the dependencies Pull requests that update a dependency file label Nov 20, 2026
@fellipeale

Copy link
Copy Markdown
Collaborator Author

Dependency vulnerability scan: main vs this PR

Scanned the zally-server.jar built from main (6846db56) and from this PR's head (d8abce0b) with Trivy (rootfs, vulnerability scanner, Trivy and Java DBs from 2026-11-20). Library dependencies only, base image excluded. Tests were skipped for the build because only the dependency set matters here.

main (Boot 2.7) this PR (Boot 3.5)
Distinct CVE/GHSA ids 149 28
Critical findings 19 7
High findings 66 11
Medium findings 50 9
Low findings 16 1

Caveats: this counts vulnerable library versions in the jar, not whether Zally's code reaches the vulnerable path. It is a snapshot of one day's database. Reproduce with trivy rootfs --scanners vuln <dir containing zally-server.jar> (a plain trivy fs skips JARs).

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant