Transaction propagation in Spring dictates how methods handle existing transactions, determining whether to run within, create a new, or skip transactions.
Using @Transactional(propagation = Propagation.REQUIRED), the method will run within an existing transaction if one exists, or create a new one if not.
Propagation.REQUIRES_NEW creates a new transaction by suspending any existing transaction, ensuring the method always runs in its own transaction context.
The key difference is that Propagation.REQUIRED joins existing transactions while Propagation.REQUIRES_NEW always initiates a new transaction, suspending the previous.
Collection
[
|
...
]