Case Study18 min read
A paved road for developers and AI agents
Eighty services, eight Maven and Spring Boot mechanisms, one paved road : the build enforces the rules, whoever writes the code 🧱

This series is one migration : ~80 Spring Boot services on Java 11 and Spring Boot 2, owned by several teams, all moving to Java 21 and Spring Boot 3, ported with AI agents. The agents turned out to be the cheap part. The expensive part is the rails that let a person trust what comes back : tests that pin what each service does today, a paved road that leaves one way to build, and skills that make the agent prove it changed nothing. This post is the second rail, the road : the parent, the BOM and the starters that every port lands on, whoever or whatever typed it.
The first part pinned what the services do today. With the behaviour locked, the next question was what they should migrate to.
Before answering, we wrote down where we stood : a study of the legacy, every item with its current state, a proposal, a gain and a cost. A menu, not a mandate. Its build section read like a list of reasons a migration goes wrong :
- No BOM. The study counted 86 service repositories, and every one of them hardcoded the versions of the shared libraries, so bumping one meant 86 pull requests. Four versions of the shared Java utils were running side by side.
- A dependency cycle. A build-tools jar declared the parent as its parent, while the parent depended on it for its Checkstyle rules, held together by an empty class whose only job was to make the jar non-empty.
- Style as an IDE chore. Checkstyle did formatting and code quality in one file, which every developer had to import into their IDE.
- Configuration hidden in libraries. Shared jars shipped a
logback.xmland sixapplication-<env>.yamlfiles with environment URIs inside, silently on every consumer’s classpath. - A scan list per service. Services pulled library beans in with
@ComponentScan(basePackages = …), one package list each, easy to get wrong. - Dependencies imposed everywhere. The parent forced around fifteen Google Cloud dependencies on every service : a ten-file service started with about two hundred jars.
- Test plugins from another era. Surefire 2.22.0, six years old, and a Failsafe milestone.
None of these is exotic, but each one is multiplied by eighty. The hard part was making sure they could not come back, one service at a time. So instead of migrating eighty services to Spring Boot 3 one by one, we built one place for them to land, a paved road, and migrated them to that.
Defaults they can override. Mandates they cannot. Everything else by inheritance.
A paved road moves those decisions out of each developer’s hands, and each agent’s, into the build, where they are checked the same way whoever wrote the code.
Maven and Spring Boot already ship every mechanism a paved road needs. The work is choosing which mechanism carries which decision. Here are the eight we use : for each one, how it works, one example, and everything we put in it.

All eight run in a public repository, small enough to read in one sitting :
vspiewakGitHub
A runnable Spring Boot platform foundation combining a BOM, parent POM, four reusable starters, and a sample service.
- Java 25
- Spring Boot 4
- Maven
1. A BOM, imported : the versions
The mechanism. A BOM is a pom that only holds <dependencyManagement>. Imported with <scope>import</scope>, it hands its versions to the consumer, and the consumer’s dependencies stop declaring any.
One example. A service imports the BOM once, then lists what it uses, never which version :
<dependencyManagement> <dependencies> <dependency> <groupId>com.acme</groupId> <artifactId>parent-bom</artifactId> <version>1.6.0</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies></dependencyManagement>
<dependencies> <dependency> <groupId>com.acme</groupId> <artifactId>utils-spring-mongo</artifactId> </dependency></dependencies>The BOM is imported by each service, not by the parent. A library bump is a BOM release, a build-policy change is a parent release, and neither waits for the other.
A release still reaches each service through a pull request. What changes is the pull request : one line, the BOM’s version, instead of one version per library, and the versions it brings were released together. Fewer choices per service, and when services fall behind, they fall behind by whole BOM versions, not library by library.
What we put in it.
- Eight imported BOMs : Spring Boot, Spring Cloud GCP, the Google Cloud libraries, the MongoDB driver, OpenTelemetry, JUnit, Cucumber, Testcontainers
- 48 managed artifacts on top : our shared libraries, the starters, and the third-party libraries the services share
- Scope as well as version : ArchUnit and WireMock are managed in
testscope, so a service that declares them gets them for its tests, unless it says otherwise - Not the contract (DTO) libraries, on purpose. A contract belongs to its producer and its consumers, so each service chooses the version it speaks.
2. A parent, inherited : the build
The mechanism. A parent pom passes its properties, plugins and plugin configuration down to every module that names it. Plugins declared in <plugins> run everywhere. Plugins in <pluginManagement> wait for a module to switch them on.
One example. Formatting is checked in every service at compile, without a line in the service :
<plugin> <groupId>com.diffplug.spotless</groupId> <artifactId>spotless-maven-plugin</artifactId> <configuration> <java> <googleJavaFormat /> <removeUnusedImports /> </java> </configuration> <executions> <execution> <goals><goal>check</goal></goals> <phase>compile</phase> </execution> </executions></plugin>A badly indented line stops the build, and the message says how to fix it :

What we put in it. Two parents : one for every Java module, one on top of it for services.
- The Java release (21) and the compiler plugin, pinned once
- Two test lanes : Surefire for
*Test, Failsafe for*IT, with Failsafe pointed at the compiled classes instead of the repackaged jar - JaCoCo, with the report bound after the integration tests so their coverage counts
- Spotless : google-java-format for Java, sorted poms, yaml, and whitespace rules for the other text files
- Checkstyle with 16 quality rules, written inline : no
System.out, noprintStackTrace(), noequalswithouthashCode, no emptycatchwithout a comment saying why. ArchUnit reads bytecode, where comments and the shape of an expression are gone, so those rules belong here. - The Enforcer rules of the next section
- A source jar
- Repackaging and build info in the service parent only, so a library never becomes an executable jar
The old onboarding for code style was a wiki page : a settings.xml edit, an IDE plugin, an XML file to import, a wrap width to set by hand. None of it is left. Spotless does the formatting, Checkstyle keeps the quality rules, written inline in the parent, and both run in the build. The build-tools jar that carried the old rules is gone, and the dependency cycle with it.
The new parents also declare no dependency at all. That problem is only half solved : the shared Java library still brings Beam and several Google Cloud clients to every service that uses it. Untangling it is a project of its own, so we reduced what is always loaded as far as we could, and left the rest.
3. Enforcer rules : what the build refuses
The mechanism. The Maven Enforcer plugin runs rules before anything is compiled, and fails the build when one is broken. Its evaluateBeanshell rule runs a small script, so a rule can be anything we can read in a pom.
One example. A <version> on a dependency is the shortcut that brings the drift back, so the parent refuses it :

The script reads the raw pom, so it sees what the developer wrote, not what Maven resolved. It searches the text, it does not parse a model : comments are stripped, then every <dependencyManagement> block and every dependency outside <build> are checked, so a plugin’s own dependencies keep their versions. It caught one more offender while it was being written : itself. Written literally, the tag names in the script matched the script’s own text when the parent scanned its own pom. They are now concatenated.
What we put in it.
- No
<version>on a dependency, except for the contract libraries, released at the pace of the two services they connect - Nothing in a service’s
<dependencyManagement>except the BOM import
Both exceptions are Maven properties of the parent, not constants in the script : the group ids allowed to carry a version, the coordinates allowed in <dependencyManagement>. So the list of exceptions is read and changed in one place.
4. EnvironmentPostProcessor : configuration in layers
The mechanism. An EnvironmentPostProcessor, registered in META-INF/spring.factories, runs before the application context exists and can add property sources to the environment. Added last, a source loses against the service’s application.yaml. Added first, it wins.
One example. Two of them build a ladder :

A mandate wins even when the service says otherwise, and the override layer logs a warning for every property it overrides. The ladder has its own test :
@Testvoid platformOverrideWinsOverServiceConfiguration() { // application.yaml says 'always' — the platform override says 'never', and wins assertThat(environment.getProperty("management.endpoint.env.show-values")).isEqualTo("never");}The environment files are still in the library, but nothing loads them by accident any more : they no longer carry Spring’s own file names, a post-processor adds them in a declared order, and every override is logged. The logback.xml is gone too : the log format is one property among the defaults.
What we put in it.
- Defaults : the structured log format for Google Cloud, the health details, the local data import switched on, and the switches of every library feature
- Mandates : the actuator never prints configuration or environment values, and the shutdown endpoint stays off
- Per-environment mandates, one file per environment : the Google Cloud project, the actuator exposure, and the MongoDB connection string. The hosts are written there, but the user and password are
${sm@…}placeholders, resolved from the secret store at startup.
5. Auto-configuration : beans without a scan list
The mechanism. A library lists its configuration classes in one file :
META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.importsSpring Boot reads that file from every jar on the classpath. A service gets the beans by adding the dependency.
One example. The MongoDB library’s file, in full :
com.acme.utils.spring.mongo.MongoAppNameConfigcom.acme.utils.spring.mongo.MongoRetryWritesConfigcom.acme.utils.spring.mongo.MongoDataImporterWhat we put in it.
- The Spring library : one entry point, behind one switch that turns the whole library off. Its package list moved into the library, once, and migrated services are a bare
@SpringBootApplication. - The MongoDB library : a connection named after the service, retryable writes, and the local data import
- Tracing for every request and logs in the Google Cloud format, with no code in the service. That one has its own post, outside the series.
6. Conditions : defaults, switches and escape hatches
The mechanism. @ConditionalOnProperty, @ConditionalOnMissingBean, @ConditionalOnClass and @Profile decide whether a bean exists. They turn a bean into a default, a switch or a default with an escape hatch, and the difference is written in the code.
One example. Retryable writes stay on, whatever the connection string says. The driver retries a failed write by default, but one retryWrites=false in a connection string turns it off, so the library turns it back on. It is not a mandate like those of the ladder : a service can still opt out, but only with a property in its own configuration, where a reviewer can see it :
@AutoConfiguration@ConditionalOnClass(MongoClientSettings.class)public class MongoRetryWritesConfig {
@Bean @ConditionalOnProperty( name = "platform.mongo.retry-writes.enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnMissingBean(name = "mongoRetryWritesCustomizer") public MongoClientSettingsBuilderCustomizer mongoRetryWritesCustomizer() { return clientSettingsBuilder -> clientSettingsBuilder.retryWrites(true); }}Spring Boot applies the connection string first and this customizer after it. A test runs that whole chain with retryWrites=false in the URI, and reads true back.
What we put in it.
- The Spring library : on unless a property turns it off
- The connection name : a default, defined only when the service has none, and an
appNamein the connection string still wins - Retryable writes : on whatever the connection string says, with a property and a bean name as escape hatches
- The data import : only in the
localprofile, only when its switch is on, and only when every MongoDB host islocalhostor127.0.0.1. The managed clusters are not reachable from a laptop, so a local run needs a local MongoDB, and this is what fills it.
7. Abstract test classes : conventions as a test dependency
The mechanism. A library on the test classpath ships abstract JUnit classes. A service extends them, and every test they declare runs in the service’s build.
One example. Adopting the conventions is two empty classes :
class ConventionsTest extends PlatformConventionsTest {}@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)class ConventionsIT extends PlatformConventionsIT {}From then on, a controller that reaches into a repository fails the build :

A service that needs more overrides a method. Every check is protected, so it adds its own rules, or acknowledges a deliberate exception with its reason, in the same class :
class ConventionsTest extends PlatformConventionsTest {
@Override protected List<NamedRule> additionalArchitectureRules() { return List.of(new NamedRule("shouldDoTheLocalThing", myRule)); }}What we put in it.
- 16 architecture rules, run with ArchUnit on the service’s main classes : the layers, no facades, no field injection, no
javaxnamespace that moved to Jakarta (the JDK’s own, likejavax.crypto, pass), repositories as interfaces, loggers as constants, no standard streams, no Joda-Time, no generic exceptions thrown, no deprecated API - 8 checks on the repository itself. Three are about its layout : no layer name in the service’s root package, the two feature files every service ships, the Cucumber entry points in their package. Five were written after things broke. A Lombok upgrade once made the payloads of 19 classes carry a field twice, as
"category"and"Category": no class may now serialise two properties that differ only by case. Deploys used to fail after a green build : every published image must now be deployed, a release-drafter configuration must exist, the CI Java version must match the Docker base image, and the probes must hit the actuator. - 8 checks that need a running service : the context loads, the shared exception handler and the shared error format are present, the application name is set and matches the artifact, the health, readiness and liveness endpoints answer
That is 32 tests in a service that wrote two empty classes.
8. Cucumber glue : the BDD vocabulary as a dependency
The mechanism. Cucumber finds step definitions through the glue packages of a test suite. A step library on the test classpath is one more glue package.
One example. The suite of a service names its own package and the step packages it uses :
@Suite@IncludeEngines("cucumber")@SelectClasspathResource("features")@ConfigurationParameter( key = GLUE_PROPERTY_NAME, value = "com.acme.service,com.acme.cucumber.http,com.acme.cucumber.mongo")public class CucumberIT {}Part one said the steps started as a copy in each service. Moved into a library, a new step is one release away from every service, and the sentences cannot diverge.
The steps are split into one package per technology, and a suite lists the ones it uses, never the parent package. The starter declares MongoDB and Pub/Sub as optional dependencies, so a service without MongoDB neither loads those steps nor inherits a driver from its tests.
What we put in it.
- 24 HTTP steps : every verb, headers, query parameters, bodies loaded from files, the status, JSON paths and the body
- 12 MongoDB steps, a hook that empties every collection before each scenario, and an initializer that creates the production and Atlas Search indexes on the test container
- 17 Pub/Sub steps : publish to a topic, assert what comes out
- 5 AlloyDB steps and 3 BigQuery steps, added in November by a teammate, each with its emulator
Part one counted what the teams wrote with this vocabulary : 1,429 scenarios from March to September.
Eight mechanisms, one set of rails
None of the eight knows who wrote the diff. An agent reads the parent, the enforcer rules and the test classes the way a new teammate does, and the build answers it the same way : a <version> on a dependency stops the build before the code compiles, a controller that reaches into a repository fails a test, a scenario it generates reads like one written by hand because the vocabulary is the same 61 steps.
When an agent hits a rule
One case, from late October. An agent porting a service bumped the BOM, and the newer conventions starter came with it. The build went red : the rule against javax namespaces that moved to Jakarta, 25 violations. All 25 were one annotation, javax.annotation.Nullable, declared on seven fields of two request classes. The agent found that eight migrated services already used the jakarta one, and stopped to ask, because the fix touched src/main. Two import lines later, one per class, the build was green. Nobody had told it about that rule. The build did.
Every rule enforced here is one the agent cannot skip, and one the reviewer does not have to check by hand. That is what the next post means by rails : the migration skills sit on top of these, and the person reviewing the pull request reads the diff, not the pom.
The numbers
Read through the GitHub API on 2026-11-23 :
- 17 releases of the BOM
- 9 releases of the Cucumber starter
- 6 releases of the conventions starter
- 7 releases of the Spring library
And on 2026-11-21, across the ~80 services :
- 13 run Java 21 in production
- 56 build with Java 21 on their main branch, not in production yet
- 8 are mid-migration, on a Java 21 branch
Each service got the same things the day it landed :
- Versions. One line, the BOM’s version, pins every shared dependency.
- Tests. Two lanes, unit and integration, with the conventions and the Cucumber vocabulary as two test dependencies.
- Formatting. Checked at
compile, fixed by one command, nothing to install in the IDE. - Configuration. The platform’s defaults under its own
application.yaml, the mandates above it. - Beans. The shared libraries by adding a dependency, with no scan list.
- Tracing and logs. For every request, in the Google Cloud format, with no code in the service.
I have not measured any of this ; it is the list of things a team no longer decides, or does by hand.
A road only works if the people building on it understand it, so I walked the engineers through it live, in the IDE, one commit at a time, with a git tool I wrote for that.
The repositories show where that leads. A teammate extended the road to the Beam pipelines : an ingestion parent and a Beam library, both built on the same Java parent, without a commit of mine. Two service developers each added the libraries they needed to the BOM with a pull request, and one of them fixed an Enforcer rule that broke on Windows. A library bump is now a pull request a teammate opens, not a request that waits for me.
The showcase : spring-paved-road
The work version is ten repositories with their own releases, on Java 21 and Spring Boot 3.5. A minimal, runnable version is public. It reproduces the mechanisms, not the topology : spring-paved-road, one Maven reactor on Java 25 and Spring Boot 4.
| Mechanism | In spring-paved-road |
|---|---|
| A BOM, imported | bom |
| A parent, inherited | parent |
| Enforcer rules | parent/pom.xml, the no-dependency-version-override execution |
| EnvironmentPostProcessor | service-starter, the property ladder |
| Auto-configuration | service-starter, mongo-starter |
| Conditions | mongo-starter, the app name and the data import |
| Abstract test classes | conventions-starter |
| Cucumber glue | cucumber-starter |
One difference : there, the parent imports the BOM, so a service needs a single <parent> line. At work, each service imports the BOM itself.
Try it yourself 🚀
- Clone
spring-paved-road - Run
./mvnw install - Indent a line badly, and build again : the build refuses it
- Everything else, from the dev loop to the property ladder, is in the README
Next in the series
This is the second part of Modernizing a Spring Boot fleet with AI agents, on rails. The road is built, and every port lands on it. Next post : the agent on those rails, the tests it must keep green, the deployed jar it must match answer for answer, and the decisions it is never allowed to make 🛤️



