Philosophy
- No Warnings.
- No Surprises.
Starting point
Spring Boot Initializr, picking gradle, java, and the dependencies recommended by the Spring Accessing JPA Data with REST guide: "Rest Repositories, Spring Data JPA, and H2 Database".
Spring Boot Config Changes
For source and application changes, consult the commit history.
- Set
spring.jpa.open-in-view=false
. Violates 1, "no warning". Setting true by default is surprising, violating 2. See this stack overflow answer. Basically Spring Boot enables by default the holding of database connections throughout the session, giving the view layer an opportunity to hydrate data on demand. This approach has issues that range from violation of principle (separation of concerns), to measurable performance. The upside is that your view layer can "dig into" an object graph. I've chosen to turn it off given how SB