In Part 1 I set out to turn a legacy Java library app into a peer-to-peer platform. In Part 2 I made the persistence real — PostgreSQL, Flyway, tests on the real engine. But the app still had a problem: it had a solid service layer and a real database, and nothing a client could actually call.
Phase 2 fixed that. And I should be honest about where I started: I had never worked with Spring controllers before. I didn't learn controllers by implementing four of them at once. I learned one — the Catalog controller, done properly, as a guide example — and then generalized the pattern to the rest.
The design decision first: entities never cross the wire
Before any controller existed, one rule was settled: controllers return thin response records, never JPA entities. The app runs with open-in-view=false and the associations on BookCopy are LAZY, so returning an entity would either serialize a lazy proxy or blow up trying.…