|
| 1 | +# Spring Boot 4 Adoption Checklist (WrongSecrets) |
| 2 | + |
| 3 | +This checklist is tailored to the current `wrongsecrets` codebase (Spring Boot `4.0.3`, Java `25`). |
| 4 | + |
| 5 | +## How to use this document |
| 6 | + |
| 7 | +- Keep this as a living checklist in PRs. |
| 8 | +- Mark items complete when merged. |
| 9 | +- Prefer small, focused migrations (one concern per PR). |
| 10 | + |
| 11 | +## Current baseline (already in place) |
| 12 | + |
| 13 | +- [x] Spring Boot `4.0.3` is configured in `pom.xml`. |
| 14 | +- [x] Spring Cloud line is aligned (`2025.1.1`). |
| 15 | +- [x] `@ConfigurationProperties` is already used in multiple places. |
| 16 | +- [x] Mockito inline-mock-maker warning addressed by passing Mockito as Java agent in Surefire. |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Priority 0 — Safety and consistency (start here) |
| 21 | + |
| 22 | +### 1) Standardize HTTP error responses with `ProblemDetail` |
| 23 | + |
| 24 | +- [ ] Add a global `@RestControllerAdvice` for API endpoints that returns `ProblemDetail`. |
| 25 | +- [ ] Keep MVC HTML error handling as-is for Thymeleaf pages; only modernize JSON API errors. |
| 26 | +- [ ] Add tests that assert RFC 9457-style payload fields (`type`, `title`, `status`, `detail`, `instance`). |
| 27 | + |
| 28 | +**Why now:** Reduces custom exception payload drift and improves API consistency. |
| 29 | + |
| 30 | +### 2) Replace new `RestTemplate` usage with `RestClient` |
| 31 | + |
| 32 | +- [ ] Stop introducing any new `RestTemplate` usage. |
| 33 | +- [ ] Migrate existing bean in `WrongSecretsApplication` from `RestTemplate` to `RestClient.Builder`. |
| 34 | +- [ ] Migrate call sites incrementally (start with `SlackNotificationService`). |
| 35 | +- [ ] Add timeout and retry policy explicitly for outbound calls. |
| 36 | + |
| 37 | +**Current state:** `RestTemplate` bean and usage exist and can be migrated safely in phases. |
| 38 | + |
| 39 | +### 3) Add/verify deprecation gate in CI |
| 40 | + |
| 41 | +- [ ] Run compile with deprecation warnings enabled in CI (`-Xlint:deprecation`). |
| 42 | +- [ ] Fail build on newly introduced deprecations (can be soft-fail initially). |
| 43 | +- [ ] Track remaining suppressions/deprecations as explicit TODOs. |
| 44 | + |
| 45 | +**Why now:** Boot 4/Spring 7 deprecations will accumulate quickly otherwise. |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## Priority 1 — Observability and operability |
| 50 | + |
| 51 | +### 4) Enable tracing + log correlation end-to-end |
| 52 | + |
| 53 | +- [ ] Ensure tracing is enabled in all non-local profiles. |
| 54 | +- [ ] Ensure logs include trace/span correlation IDs. |
| 55 | +- [ ] Add dashboard/alerts for key challenge-flow operations. |
| 56 | + |
| 57 | +### 5) Harden Actuator for production profiles |
| 58 | + |
| 59 | +- [ ] Verify readiness/liveness probes are exposed and used by deployment manifests. |
| 60 | +- [ ] Restrict sensitive actuator endpoints by profile. |
| 61 | +- [ ] Add health contributors for external dependencies used in runtime profiles. |
| 62 | + |
| 63 | +### 6) Structured logging profile |
| 64 | + |
| 65 | +- [ ] Use JSON logs for cloud/container profiles. |
| 66 | +- [ ] Keep developer-friendly text logs for local profile. |
| 67 | +- [ ] Document expected log fields for incident response. |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## Priority 2 — Runtime and performance |
| 72 | + |
| 73 | +### 7) Evaluate virtual threads for I/O-heavy flows |
| 74 | + |
| 75 | +- [ ] Add profile-based toggle (`spring.threads.virtual.enabled=true`) for evaluation. |
| 76 | +- [ ] Run load comparison (latency, throughput, memory) before default-enabling. |
| 77 | +- [ ] Keep a rollback toggle in case of third-party incompatibilities. |
| 78 | + |
| 79 | +### 8) Validate graceful shutdown behavior |
| 80 | + |
| 81 | +- [ ] Verify request drain behavior on shutdown in containerized environments. |
| 82 | +- [ ] Confirm no challenge state corruption occurs during rolling updates. |
| 83 | + |
| 84 | +### 9) AOT/native readiness checks |
| 85 | + |
| 86 | +- [ ] Add optional CI job for AOT/native compatibility (not necessarily release artifact yet). |
| 87 | +- [ ] Record blockers (reflection/dynamic proxies/resources) in this document. |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## Priority 3 — Security and configuration posture |
| 92 | + |
| 93 | +### 10) Expand typed config, reduce scattered `@Value` |
| 94 | + |
| 95 | +- [ ] Introduce/extend `@ConfigurationProperties` classes for grouped settings. |
| 96 | +- [ ] Limit direct `@Value` usage to simple one-off values. |
| 97 | +- [ ] Validate config with bean validation annotations. |
| 98 | + |
| 99 | +### 11) TLS/SSL bundles standardization |
| 100 | + |
| 101 | +- [ ] Use SSL bundle config for outbound TLS trust/key material where applicable. |
| 102 | +- [ ] Remove ad-hoc SSL setup code if present. |
| 103 | + |
| 104 | +### 12) Secret handling consistency by profile |
| 105 | + |
| 106 | +- [ ] Document expected secret source per profile (`docker`, `k8s`, `aws`, `gcp`, `azure`). |
| 107 | +- [ ] Ensure no fallback path accidentally logs sensitive values. |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## Priority 4 — Testing modernization |
| 112 | + |
| 113 | +### 13) Keep Mockito java-agent setup stable |
| 114 | + |
| 115 | +- [x] Surefire passes Mockito as `-javaagent`. |
| 116 | +- [ ] Mirror same setup in Failsafe if/when integration tests use inline mocking. |
| 117 | + |
| 118 | +### 14) Strengthen integration testing with Testcontainers service connection patterns |
| 119 | + |
| 120 | +- [ ] Prefer service-connection style wiring for test dependencies. |
| 121 | +- [ ] Reduce custom bootstrapping code in integration tests where possible. |
| 122 | + |
| 123 | +### 15) Add contract tests for outbound HTTP clients |
| 124 | + |
| 125 | +- [ ] Add tests for success, timeout, retry, and non-2xx mapping behavior. |
| 126 | +- [ ] Ensure migrated `RestClient` paths are fully covered. |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## Concrete first 5 PRs |
| 131 | + |
| 132 | +1. **PR 1:** Add API `ProblemDetail` advice + tests. |
| 133 | +2. **PR 2:** Introduce `RestClient` bean and migrate `SlackNotificationService`. |
| 134 | +3. **PR 3:** Add deprecation checks to CI and document policy. |
| 135 | +4. **PR 4:** Add tracing/log-correlation defaults for non-local profiles. |
| 136 | +5. **PR 5:** Virtual thread evaluation profile + benchmark notes. |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## Definition of done for Boot 4 adoption |
| 141 | + |
| 142 | +- [ ] No new `RestTemplate` code introduced. |
| 143 | +- [ ] API errors are standardized on `ProblemDetail`. |
| 144 | +- [ ] Deprecation warnings are tracked and controlled in CI. |
| 145 | +- [ ] Observability baseline (metrics, traces, log correlation) is active in non-local profiles. |
| 146 | +- [ ] Migration choices and rollout decisions are documented in `docs/`. |
0 commit comments