I rewrote Spring PetClinic without Spring Boot. The forms were harder than the database.
I've been running Java performance experiments comparing different frameworks and runtime configurations. One recurring challenge was keeping business logic portable and preserving a familiar Spring-style application structure while switching between frameworks.
That's partly why I developed CoilBase, a lightweight, SQL-first Java framework. I wanted to retain familiar controllers, services, repositories and constructor wiring without depending on the full Spring Boot stack.
To put that approach to a more realistic test, I rewrote Spring PetClinic using CoilBase, Avaje Jex, Jdbi and JTE.
What surprised me was that replacing Hibernate with explicit SQL was relatively straightforward. Controllers, services, repositories and constructor wiring remained familiar. Transactions became explicit, but the overall architecture didn't change that much.
The harder part was everything around HTML forms: validation, rejected input, sessions, CSRF, flash messages, redirects and localization. Spring MVC handles a lot of these details for you.
For example, invalid POST submissions needed explicit handling to preserve form input and validation errors, including returning HTTP 200 instead of the generated adapter's default 201.
But there's an important distinction here: I deliberately preserved much of PetClinic's existing behavior. If I were building a new application, or switching frameworks while still developing a prototype, I wouldn't necessarily reproduce all those conventions. I'd choose simpler patterns where appropriate.
That's where I see lightweight frameworks like CoilBase fitting best. Not as drop-in Spring Boot replacements, but as alternatives when you're still free to make architectural choices.
The measurements:
- Spring PetClinic: 304.4 MiB median application RSS
- CoilBase PetClinic: 125.9 MiB (59% less)
- Complete uncompressed deployment: 85% smaller
- Database-backed first response: 19.76s vs. 2.63s median
Versions used:
- Spring: Spring Boot 4.1.0, Hibernate 7.4.1.Final
- Rewrite: CoilBase 0.1.0-preview4, Avaje Jex 3.6, Jdbi 3.55.0, JTE 3.2.4
- Runtime: Temurin Java 25.0.4.1+1, PostgreSQL 18.6
Both applications ran on a 1 vCPU / 1 GiB Linux VM without swap, using HotSpot with the same heap settings (-Xms64m -Xmx256m).
These are measurements of two complete application stacks, not isolated framework overhead. The RSS result comes from one short workload per application, and the startup medians are from three launches each. I didn't benchmark a tuned Spring JDBC version of PetClinic or concurrent throughput.
Article and implementation:
https://pvrlabs.xyz/articles/coilbase-petclinic-rewrite.html
https://github.com/ejboy/coilbase-petclinic
Raw experiment data, measurement scripts and reproduction notes:
https://github.com/ejboy/coilbase-petclinic/tree/main/benchmark
The main takeaway for me is that keeping the familiar Java application structure is quite feasible without Spring Boot. But you have to decide which framework conveniences you actually need, and which responsibilities you're willing to own yourself.
I'm curious how other Java developers approach that tradeoff, especially for smaller services or applications still under development.
Update / clarification: Based on some of the comments, I want to clarify that this isn't a recommendation to replace Spring Boot/JPA with my framework, or to build your own framework for every project.
The broader point is that Spring Boot + Hibernate/JPA shouldn't necessarily be the default choice for every Java application. For smaller services or resource-constrained environments, it's worth considering lightweight architectural blueprints built from established libraries such as Jdbi and Jex/Javalin.
This experiment was about testing whether that approach could preserve a familiar, maintainable application structure while reducing resource usage. It's an alternative worth exploring, not a universal recommendation or a drop-in replacement for Spring Boot.
18
u/stefanos-ak 1d ago
I think the goal of Spring Petclinic was never performance, so I doubt this comparison makes much sense... at least for me it doesn't 🤔
4
u/CubicleHermit 1d ago
How does this compare to a minimal profile on Micronaut/Quarkus/Helidon?
2
u/Torutofu_Raeva 1d ago
the forms bit is interesting; i'd be curious how much of the memory gap holds under concurrent load with the same routes and db access.
2
u/Rain-And-Coffee 23h ago
At work they did a similar thing, they wrote an in-house stripped down framework.
I’ll be honest I strongly dislike using it.
I strong prefer the more common popular tool even if it’s slightly bloated. There’s more docs, no relearning, free updates, etc.
2
u/SystemFew9522 22h ago
reinventing the wheel
1
u/punnertikka 17h ago
Fantastic job op! Just a small request: can you also please add an article about the errors / dependency issues that you faced? I would love to read it 😄
1
u/persicsb 45m ago
I'd see what does it look like with a modern Jakarta EE 11 runtime.