The annotation is applied by a proxy. Calling the method from inside the same bean bypasses the proxy entirely.
@Service
public class OrderService {
public void placeAll(List<Order> orders) {
orders.forEach(this::place); // self-call: NO transaction
}
@Transactional
public void place(Order order) { /* ... */ }
}
place() runs with no transaction when called from placeAll().
Fix: inject the bean into itself, use ObjectProvider, or move place() to another bean.
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