Spring Transaction Propagation: REQUIRED vs REQUIRES_NEW
Fast recall
Quick revision
Core answer
Understanding of transaction propagation — shows you know that at-Transactional has behavior beyond just wrapping a method in begin/commit/rollback.
Not knowing that REQUIRED is the default, or thinking every at-Transactional always creates a new transaction regardless of context.
Give a use case for REQUIRES_NEW: audit logging that should be committed even if the main transaction rolls back, or processing individual batch items independently.
Interview-ready guide
Interview answer
Propagation controls how an annotated call relates to an existing transaction. REQUIRED is the default: it joins the current transaction or starts one. REQUIRES_NEW uses a separate physical transaction and suspends the outer one when the manager supports that operation. Its committed data is not undone by a later outer rollback, but an uncaught inner exception can still fail the outer method. A separate database transaction usually needs another connection and cannot see the outer transaction's uncommitted rows. That makes REQUIRES_NEW suitable only for truly independent work, such as a standalone audit-attempt record. In proxy mode, self-invocation skips the inner propagation setting.
Spring Transaction Propagation: REQUIRED vs REQUIRES_NEW
Direct Answer
Transaction propagation defines how a transactional method relates to an existing transaction. REQUIRED, the default, joins one or starts one. REQUIRES_NEW uses a separate physical transaction and suspends the current one when the transaction manager supports suspension; its commit is not undone by a later outer rollback, though an uncaught inner exception can still make the outer method fail.
Code Example
@Service
public class PaymentService {
// Joins the caller's transaction or starts one.
@Transactional(propagation = Propagation.REQUIRED)
public void pay(String requestId, Order order) {
orderRepo.save(order);
auditService.recordAttempt(requestId);
}
}
@Service
public class AuditService {
// Separate transaction; the record must not reference an uncommitted order row.
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void recordAttempt(String requestId) {
auditRepo.save(new AuditEntry(requestId, "PAYMENT_ATTEMPT"));
}
}
The audit commit is independent of a later outer rollback. In practice, decide how an audit failure propagates and size the connection pool for the extra transaction.
Common Mistakes & Pitfalls
- Not knowing REQUIRED is the default: Freshers think every at-Transactional starts a new transaction, but by default methods join existing transactions, which is usually what you want.
- Overusing REQUIRES_NEW: Creating independent transactions everywhere breaks atomicity — if orderService calls inventoryService with REQUIRES_NEW, the inventory update commits even if the order creation fails.
- Ignoring self-invocation: Propagation only applies when Spring's proxy intercepts the call — calling a REQUIRES_NEW method from within the same class doesn't create a new transaction.
Check your understanding
Answer these without looking back at the article.
- What happens to the outer transaction if REQUIRES_NEW inner transaction fails?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.