Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Transactions and Proxies

Front

How does Spring handle transactions with dynamic proxies?

Spring uses proxies to manage transactions at runtime. Spring uses dynamic proxies to wrap beans with additional behavior…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Why move methods to external beans for transactions?

Ensures proxy-mediated transaction management. Moving methods that require transactions to separate beans ensures they are accessed through a…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

What happens when a self-invoked method has @Transactional?

Self-invocation bypasses the proxy, disabling @Transactional. If a method within the same class calls another method with @Transactional,…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Why use @Transactional in a Spring application?

@Transactional manages transactions automatically, reducing boilerplate code. In Spring, using @Transactional simplifies transaction management by automatically handling commit…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Enabling Transaction Management in Spring Boot?

Use @EnableTransactionManagement to activate. To enable transaction management in a Spring Boot application, annotate a configuration class with…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Bean Scope Impact on Transactions?

Prototype scope can lead to inconsistent transactions. Using prototype scope for transactional beans can lead to multiple instances…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

CGLIB Proxy Limitations?

CGLIB proxies can increase complexity and overhead. CGLIB proxies create subclasses at runtime, which can lead to complexity…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Configuring Transaction Management?

Transaction settings are in application properties. In Spring Boot, transaction management settings like default rollback rules can be…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Transaction Rollback on Exceptions?

Runtime exceptions trigger rollback by default. By default, Spring rolls back transactions on unchecked exceptions (RuntimeException). To rollback…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Proxy Types: Interface vs. CGLIB?

Interface proxies are preferred for simpler objects. Interface-based proxies (JDK dynamic proxies) are used when a class implements…

View Card →