Spring Boot enables it by default; it keeps the session open through rendering, so lazy loads succeed - one query at a time.
// application.yml
spring:
jpa:
open-in-view: false # turn it OFF and see the truth
With open-in-view=true : the page renders, quietly issuing 500 queries.
With open-in-view=false: you get LazyInitializationException in development,
which is the error you wanted before shipping.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-11