I like the way a conventional Spring application is organized. Controllers handle HTTP, repositories handle persistence, and business operations have somewhere sensible to live. Constructor dependencies make those relationships easy to follow.
How much of that architecture actually requires the Spring Boot runtime?
To explore that question, I rebuilt Spring PetClinic without Spring Boot and Hibernate, using CoilBase, a lightweight Java framework I developed for my performance experiments, where I often port applications between frameworks.
In the measured PostgreSQL deployment, application process RSS fell from 304.4 MiB to 125.9 MiB: approximately 58.6%, rounded to 59% in the title. This measures the combined effect of replacing Spring Boot and Hibernate in this application, not the individual contribution of either component.
The more interesting discovery was where the work went. Replacing persistence was relatively straightforward. Replacing the conveniences around a form required more thought.
A recognizable application
PetClinic gives the experiment something more substantial than a JSON greeting. Owners have pets, pets have visits, and the application has search, pagination, editing, validation and veterinarian views.
The rewrite uses CoilBase, Avaje Jex, generated HTTP routing adapters and precompiled JTE templates.
The rewrite keeps the Spring application patterns I find useful: controllers, services, repositories and constructor dependencies. The aim is to preserve that structure while replacing runtime dependency injection, auto-configuration and ORM persistence with explicit wiring and SQL. It does not preserve every upstream boundary mechanically: ClinicService provides an explicit home for write transactions and relationship loading.
Here is an excerpt from the actual application wiring:
var owners = new OwnerRepository(db());
var pets = new PetRepository(db());
var clinic = new ClinicService(db(), owners, pets, new VisitRepository(db()));
var sessions = new Sessions(config.secureCookie(), Duration.ofMinutes(30), 10_000);
var views = new Views();
var ownerController = new OwnerController(clinic, sessions, views);
var petController = new PetController(clinic, sessions, views);
jex.routing(new OwnerController$Route(ownerController));
Dependencies are ordinary constructor arguments. Avaje generates the route adapter at compile time; the application constructs the controller and registers that adapter with Jex. There is no runtime dependency-injection container assembling this graph.
Auto-configuration trades explicit setup for conventions and conditional behavior. Here, I prefer to see which components are created and how they fit together. That makes the startup path easy to inspect, but adding another component becomes an explicit wiring change. Spring's automatic assembly remains useful when an application has many integrations and configuration combinations.
SQL and transactions stay visible
Spring PetClinic uses Spring Data JPA and Hibernate. The port uses CoilBase's Jdbi-backed repositories, parameter binding and explicit row mapping. SQL replaces repository-derived persistence operations and ORM relationship management.
The service's owner-loading path fetches the owner, loads its pets, and loads visits for each pet. There is no persistence context deciding when relationships should be fetched. That is understandable code, but the query count is now clearly an application responsibility.
The write boundary is equally visible. These are actual methods from ClinicService:
int createOwner(OwnerForm form) {
return db.transactional(() -> owners.insert(form));
}
void updateOwner(int id, OwnerForm form) {
db.transactional(() -> owners.update(id, form));
}
Repository operations inside the managed boundary participate in the transaction, and escaping failures roll it back. Developers must choose those boundaries and test failure behavior. A duplicate-pet precheck helps produce a useful field error; a database uniqueness constraint still arbitrates competing writes.
This removes ORM mapping and implicit persistence behavior, while adding SQL, mapping and loading decisions. Whether that is simpler depends on the application and the team's preferred way of reasoning about data.
The form was harder than the repository
A form submission carries more behavior than its controller method initially suggests: decoding, rejected input, validation messages, locale selection, status codes, redirects, CSRF and flash messages.
Spring MVC and its surrounding integrations provide much of that machinery. In this port, the controller reads fields, verifies CSRF, validates an application form object, and either renders errors or calls the service and redirects. Invalid POST forms explicitly select status 200 because the generated POST adapter otherwise defaults to 201.
JTE replaces Thymeleaf here. Templates are precompiled, so the runtime needs the JTE runtime rather than its compiler. This is an application choice; CoilBase does not require JTE.
The application also configures its Hikari datasource and owns its lifecycle. Sessions are bounded and process-local, with CSRF tokens and one-use flash messages. They disappear on restart and do not support multiple application instances. English and Spanish are selected through Accept-Language.
Those details are part of the engineering cost. Removing automatic infrastructure does not remove the underlying responsibilities. The migration notes explain where this implementation makes them explicit.
Similar workflows, bounded compatibility
The two applications were exercised through a shared real-HTTP contract on H2 and PostgreSQL. Checks cover representative owner searches and edits, pets, visits, validation, redirects, veterinarian HTML and JSON, navigation and assets. Independent database queries inspect committed rows and selected invalid writes. Restart checks verify persistence without reinitializing the schema.
The contract documentation describes reproduction using separately built applications and disposable databases. These checks support representative behavioral compatibility, not complete feature parity.
Accepted differences include 404 responses for missing owners or pets, fewer locales, different flash-consumption behavior, and no Actuator, WebJar endpoints or Spring vet cache. The port has no authentication and has not undergone a production security audit. It is a reference application, not a deployment security blueprint.
What the measurements show
The measured Spring application used Spring Boot 4.1.0 and Hibernate 7.4.1.Final. The rewrite used CoilBase 0.1.0-preview4, Avaje Jex 3.6 and Jdbi 3.55.0.
Both applications ran sequentially on the same warm-host x86-64 Linux VM: one vCPU, 1 GiB allocated RAM, no swap, Temurin 25.0.4.1+1 and -Xms64m -Xmx256m. The JVM selected Serial GC for both. PostgreSQL 18.6 ran in the same VM with separate databases and matching pinned fixtures, C.UTF-8 collation, 128 MiB shared buffers, 100 maximum connections and 4 MiB work memory.
These are HotSpot results. No Native Image PetClinic measurement is included.
| Measurement | Spring PetClinic | CoilBase PetClinic |
|---|---|---|
| Median application RSS, workload plus quiet interval | 304.4 MiB | 125.9 MiB |
| Complete uncompressed deployment | 65,607,443 bytes | 9,775,305 bytes |
| Median first root response, three starts | 15.26 s | 1.18 s |
| Median database-backed owner response, three separate starts | 19.76 s | 2.63 s |
The benchmark record includes raw workload captures, analysis scripts, JVM evidence and reproduction instructions. The curated evidence was published in commit 8c2b656, after the original measurements; no benchmarks were rerun.
The complete deployment was approximately 85% smaller (85.1% by uncompressed bytes). The deployment sizes include application files and runtime libraries. Spring used its extracted layout. They exclude the JVM and database installation; comparing only the small application JARs would miss most of either deployment.
RSS was sampled once per second during one short read workload and ten subsequent quiet seconds. There were 13 samples for Spring and 11 for CoilBase, mostly quiet. These are samples within one run, not independent benchmark repetitions. The title describes application RSS; it does not describe heap usage, total server memory, or guaranteed minimum RAM. Summing PostgreSQL process RSS would double-count shared pages, so it should not be added to these values.
Readiness needs particular care. The root page can respond before CoilBase initializes its database pool. A separate follow-up measured launch to a complete /owners/1 response containing Franklin, polling every 100 ms with a two-second request timeout. That follow-up occurred after a VM restart and fresh smoke checks; it is not paired with the root sequence. Spring's three owner-readiness observations ranged from 15.19 to 28.90 seconds. Three starts do not characterize a startup-time distribution.
After one warm-up cycle, each of eight paths received 20 serial requests. The client shared the VM, followed redirects and timed complete response reads. All recorded requests returned 200.
CoilBase had the lower median on seven of eight paths. Spring won the veterinarian JSON path, where it caches veterinarian data and the port does not. Relationship queries also differ. The port's owner-details HTML was 1,278 bytes compared with Spring's 4,180 bytes. Rendering, payload sizes, caching and SQL all contribute to these timings.
This comparison therefore cannot isolate the cost of Spring Boot, Jex, Hibernate or CoilBase individually. It also says nothing about concurrent throughput, sustained load, write performance, saturation or tail latency. Those require different experiments.
This isn't my first experiment with these tradeoffs. In an earlier five-stack comparison, Spring Boot with JDBC and without Hibernate used approximately 181–188 MiB RSS across two HotSpot runs, compared with approximately 116 MiB for Jex + CoilBase. In a separate Hibernate versus Jdbi experiment, direct Hibernate used approximately 152 MiB versus 96 MiB for Jdbi in a lightweight stack. These were different applications and workloads, so the savings cannot be added together or directly assigned to PetClinic. But they demonstrate that both framework and persistence choices can significantly affect memory usage.
There were procedural limitations too. A collector shutdown race affected analysis after the first Spring start; its timing was retained, collection was corrected, and a pause and smoke run added host warming before subsequent observations. The measurements describe the original application builds; subsequent application changes were not remeasured. Build details are recorded with the benchmark results.
A foundation with a smaller scope
CoilBase provides repository conveniences, explicit transaction handling and optional Jex application integration around Jdbi. Core is independent of an HTTP framework and dependency-injection container. It does not try to become an ORM, reproduce every Spring integration, or provide automatic migration compatibility.
That boundary matters. If every convenience removed from Spring were rebuilt as a general-purpose subsystem, the project would steadily recreate the framework it set out to avoid. Here, form handling and sessions remain concrete application decisions.
For a smaller service or a resource-constrained deployment, visible SQL, explicit dependencies and a compact runtime may be attractive. The application owner must be comfortable maintaining infrastructure choices, query behavior and operational boundaries. CoilBase is also a preview, with APIs that may change.
Spring Boot remains an excellent choice when its integrated ecosystem, established conventions and ready-made facilities save more work than explicit assembly would. This experiment does not measure the engineering cost of those capabilities or show what a tuned Spring JDBC version of PetClinic would consume.
What it does show is that much of the familiar Java application structure can survive without Spring Boot and Hibernate. In this PetClinic rewrite, that came with substantially lower measured application RSS and a smaller deployment, together with more explicit responsibility for the details around the application. The useful decision is whether those responsibilities fit the service and the people maintaining it.
Experiment data and related resources
The benchmark record includes the methodology, measured build details, workload summaries and readiness observations. The implementation includes migration notes and instructions for running the shared application checks.
Experiment results PetClinic implementation CoilBase on GitHub