Spring Data JPA - Lazy Loaded collection fetched without @Transactional

Spring Boot uses an OpenEntityManagerInView interceptor by default. You can turn it off by setting the property spring.jpa.open-in-view to false.

See the documentation for the reference about this (and other) JPA properties.


You could turn on logging to check if a Transaction is being opened.

org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction

or

org.hibernate.engine.transaction.internal.jta.JtaTransaction

Also, you could set a breakpoint and use this static method to check if a transaction is open.

org.springframework.transaction.support.TransactionSynchronizationManager.isActualTransactionActive()