r/JavaProgramming • u/fykup • 1h ago
I rewrote Spring PetClinic without Spring Boot or Hibernate. 59% less RAM, but forms were harder.
I develop CoilBase, so this is my own experiment. I wanted to see how much of a conventional Spring application I could keep without the Spring Boot runtime, so I rewrote Spring PetClinic using CoilBase, Avaje Jex, Jdbi and JTE.
Replacing Hibernate with explicit SQL was relatively straightforward. Controllers, services, repositories and constructor wiring all stayed familiar.
The harder part was everything Spring MVC normally handles for you: form binding, validation, sessions, CSRF, flash messages, redirects and localization.
For example, invalid form submissions needed explicit handling to preserve user input and validation errors, including overriding the generated POST adapter's default HTTP 201 response with 200. Small details like that added up.
On a 1 vCPU, 1 GiB VM with PostgreSQL, the rewrite used 126 MiB of application RSS versus 304 MiB for the original (59% less). The complete uncompressed deployment was also 85% smaller.
Both ran on Java 25 HotSpot with the same heap settings. These are complete-stack results from a short workload, not isolated framework costs.
Implementation, tradeoffs and benchmark limitations:
https://pvrlabs.xyz/articles/coilbase-petclinic-rewrite.html
For anyone who's moved off Spring MVC, or considered it: which convenience would you miss most?