By default, Spring Boot uses an OpenEntityManagerInViewInterceptor which “binds a JPA EntityManager to the thread for the entire processing of the request […] to allow for lazy loading in web views despite the original transactions already being completed”.
In other words, in every
@RestController action, instead of throwing a
LazyInitializationException when you forget to fetch a lazy-loaded property, Spring will now fetch the property outside of the original transaction. The pattern (or antipattern) is called Open Session In View (OSIV) and, while it sounds fairly useful, is not a good choice for production environments.