Skip to main content
Back to AI Commerce Lab
Engineering·November 2026·9 min read

Inheriting a 10-Year-Old Spring Boot Monolith: Three Weeks In

A codebase that has been in production for a decade is not a mess. It is a long argument, written in Java, between every engineer who ever worked here and the problems they were paid to solve. Three weeks in, the job is to read the argument, not win it.

The brief is usually short: the monolith is slow, deploys are painful, and the senior engineers who hold most of the context are leaving. The CTO wants an outside read before writing a modernization budget.

The figures below are illustrative. They are representative of codebases like this, not one client's audit.

Three weeks is the window where you can still see the system clearly. By week 6 you have internalised its tradeoffs and stopped flinching at them. These notes are for that window.

The framework is older than it looks

The application runs on Spring Boot 2.7 and Java 8. Both are out of support. Spring Boot 2.x reached end of open-source maintenance in November 2023, with commercial support running to August 2026.

Oracle's Java 8 Public Updates ended in 2019; paid Premier support runs to December 2030, for teams that pay for it.

Framework age sets the floor on everything else. Spring Boot 3 requires Java 17 and Jakarta EE namespaces. That is one migration, not two, and it touches every import in roughly 850k lines of Java across more than 100 Maven modules.

The team knows this. Nobody has had 3 uninterrupted weeks to plan it.

What the first week turns up

The clean way to read a legacy codebase is to measure before judging. Here is the first-week sweep, with the kind of value it returns on a codebase this size and the command that produces it.

FindingIllustrative valueHow measured
Lines of production JavaRoughly 850kcloc src/main/java
Maven modulesMore than 100find . -name pom.xml | wc -l
Test filesAround 2,400find . -path '*/test/*' -name '*.java' | wc -l
Tests disabled by defaultAbout 400 of 3,200grep -r "@Disabled|@Ignore"
Cold-start time (local, SSD)Over 4 minutesActuator startup trace
Spring beans at startupAround 9,000Actuator /beans
HTTP endpointsAbout 400Actuator /mappings
Endpoints with no production traffic in 90 daysAbout 1 in 5Access-log parse
Dependencies with a published High or Critical CVEMore than a dozen, a few CriticalOWASP Dependency-Check
SQL built by string concatenationDozens of statementsSemgrep p/java.lang.security.audit

Nothing on that table is new to the team. The value of running it is a shared baseline. Before the audit, the SQL-injection count is "some." After, it is a number, with a per-file list.

The startup problem is a boot-sequence problem

Four minutes to start a service is not a framework issue. Spring Boot 2.7 on Java 8 cold-starts in seconds at the simple end. The 4-minute figure is the application's own code running during initialisation.

The Actuator startup trace tells you where. An illustrative trace, trimmed to the top offenders:

$ curl -s localhost:8080/actuator/startup | jq '.timeline.events |
    sort_by(.duration) | reverse | .[0:5]'

[
  { "name": "spring.beans.instantiate:catalogIndexWarmer",     "duration": "PT1M10S" },
  { "name": "spring.beans.instantiate:membershipCache",        "duration": "PT45S"  },
  { "name": "spring.beans.instantiate:currencyRatesLoader",    "duration": "PT40S"  },
  { "name": "spring.beans.instantiate:legacyConfigResolver",   "duration": "PT20S"  },
  { "name": "spring.beans.instantiate:schemaMigrator",         "duration": "PT20S"  }
]

Five beans account for more than 3 of the 4 minutes. Each one is a well-intentioned optimisation: warm a cache, preload rates, resolve config, run migrations. None of them has to happen before the service accepts traffic.

The fix is not a rewrite. It is @Lazy on 4 of the 5 beans and a readiness probe that keeps the pod out of the load-balancer rotation until the warmers finish in the background. Framework-level primitives, applied where the measurement says.

Expected startup after the change is closer to 1 minute than 4, going by what is left on the boot path.

The tests are passing. They are also lying.

A pass rate above 90% on a few thousand tests sounds healthy. It is not, because of 3 patterns.

  • About 400 tests disabled with @Disabled("flaky") or @Disabled("rewrite in progress"). Not counted against the pass rate.
  • Integration tests using an in-memory H2 database when production is PostgreSQL. A handful of production incidents a year come from behaviour that differs between H2 and Postgres (window functions, lateral joins, array operators).
  • Mocks for the external payment provider return a 200 with an authorised payload no matter what the input is. The real sandbox returns a 400 for half the edge cases the test file claims to cover.

The test suite is a shape, not a gate. That is the harder finding, because the fix is social, not technical.

People trust the green check. You cannot ask them to stop trusting it; you have to make it worth trusting.

The staged plan: enable the disabled tests one package per week, triage the real failures in a time-boxed meeting, and migrate integration tests to Testcontainers for PostgreSQL before the next release train. Not glamorous. Load-bearing.

Config lives in 11 places

The application reads configuration from:

  1. application.properties per profile
  2. application.yml (introduced later; both are live)
  3. Environment variables
  4. JVM system properties
  5. A config table in the main database
  6. Apache ZooKeeper (added for one feature, never removed)
  7. HashiCorp Consul (added for a different feature)
  8. Spring Cloud Config Server (used by a few modules)
  9. AWS Systems Manager Parameter Store (the newest)
  10. Hard-coded constants in Java files
  11. A README that documents a value read from nowhere

Each addition made sense at the time. The sum is a configuration surface no new engineer can mentally model.

One value — the maximum upload size — lives in several of the 11 places with different values. Which one wins depends on which pod handles the request.

Config consolidation is a 2-quarter project. In week 3 we are not fixing it.

We are writing a single document that lists every config key, where it lives, and which of the 11 sources wins when they disagree. That document is usually the first artifact a team agrees is worth keeping up to date.

What we are changing in week 4

The modernization proposal we are writing for the CTO does not start with Spring Boot 3. It starts with 4 smaller changes that pay off inside one quarter.

  1. @Lazy on the 4 boot beans and a readiness probe. Startup goes from over 4 minutes to closer to 1. Deploys get faster; incident recovery gets faster.
  2. Testcontainers for the top 20 integration test files, chosen by production-incident provenance. The flake rate drops; the H2-versus-Postgres incidents stop.
  3. The string-concatenated SQL statements get prepared statements. The security scan stops failing.
  4. The dead endpoints get a 2-week deprecation header, then deletion. About a fifth of the endpoints gone, and less code to migrate when Spring Boot 3 lands.

Spring Boot 3 comes after that. Jakarta EE namespace migration, Java 17, a tooling choice (OpenRewrite or hand-written), and the tests to prove it.

That is a multi-quarter plan with a real budget line. It is not what you do while startup is still 4 minutes.

What we are not touching, on purpose

Three things to identify in week 2 and park.

  • The ORM layer. The application uses Hibernate 5 with a mix of JPA and native queries. A migration to Hibernate 6 is coupled to the Jakarta EE move. Doing it earlier is weeks of churn for no customer-visible change.
  • The scheduler rewrite. Spring's @Scheduled runs dozens of jobs; the team wants JobRunr for distributed scheduling. Valid change, wrong quarter — it blocks the modernization budget on a project that is not on the critical path.
  • The admin console. A JSP layer serves a handful of people per week. It will die when the service becomes an API. Rewriting it in React now is a vanity project.

Earned opinions, each one. The hard part of the first 3 weeks is deciding what not to do.

What we would tell any team inheriting a decade-old codebase

Three rules for any inherited codebase, whatever the industry.

Measure before judging. An exact line count is more useful than the word "large." A measured dead-endpoint percentage is more useful than "some cleanup." Specific numbers move budget; vague ones generate meetings.

The first quarter's changes should not need the second quarter's budget. Startup time, test reliability, SQL hygiene and dead-code removal are week-scale fixes that make the later migration cheaper. A proposal that only asks for the big budget is a proposal that will not get approved.

Do not fix what you have not understood. Every decade-old codebase has dozens of anti-patterns, and some of them are load-bearing in ways you will discover the hard way.

Keep a parked list and come back after you have shipped something.

FAQ

How long should an audit of a monolith this size take?

Two to three weeks if the goal is a modernization plan. Week 1 is measurement, week 2 is interviews with the team, week 3 is writing. Longer than that and the team has stopped treating you as a guest.

What does the team own after we leave?

The measurement scripts, the config inventory, the test-migration plan, and a modernization proposal written against their budget calendar. The scripts are the part that survives — a document goes stale in 6 months; a script re-derives the state on demand.

Why not propose Spring Boot 3 straight away?

Spring Boot 3 needs Java 17, Jakarta EE namespaces, and a round of dependency upgrades. It is a 2-quarter engagement on a codebase like this. Proposing it in week 3 bypasses the smaller changes that pay for the big one.

What is the budget for the first quarter of work?

At this scale, a single pair of senior engineers for 10 to 12 weeks delivers startup, tests, SQL hygiene and dead-code removal. The Spring Boot 3 work needs 4 to 6 engineers across 2 quarters.

Are these numbers from a real codebase?

No single one. They are illustrative: rounded, and representative of a decade-old Spring Boot application with a long-tenure team. They are not one client's audit.

If a number here matches your codebase, you have a similar problem.

Would a greenfield rewrite be faster?

Almost never. The code encodes 10 years of business rules that nobody can enumerate.

A rewrite discovers them by breaking in production. Incremental modernization is slower on paper and faster in practice.

References

From the Destm engineering archive. For current work on this topic, start at Solutions or the blog.