Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Transactions and Proxies

Front

Constructor Injection vs. Field Injection?

Constructor injection is safer for transactional beans. Constructor injection is preferred over field injection in Spring because it…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Bean Scopes and Transactions?

Use singleton scope for transactional services. Transactional services should typically have a singleton scope to ensure consistent transaction…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Moving Methods for Atomic Safety?

Externalize methods for proxy invocation. Frame the concept in practical terms so you can explain it during interview…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Self-invocation and Transaction Proxies?

Self-invocation bypasses transaction proxies. In Spring, if a method within the same class calls another method marked with…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Spring Dynamic Proxy Patterns?

Spring uses proxies to handle cross-cutting concerns. Spring uses dynamic proxies to implement cross-cutting concerns like transactions. Proxies…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

Understanding @Transactional in Spring?

@Transactional manages database transactions. The @Transactional annotation in Spring ensures that a method is executed within a transaction…

View Card →
Flashcard Study

Java: Transactions and Proxies

Front

What is transaction self-invocation in Spring, and why is it risky?

A bean calling its own transactional method can bypass the proxy that applies transaction advice. Spring often implements…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

How does self-invocation affect transaction management in Spring?

Self-invocation bypasses Spring's proxy, affecting transactional behavior. When a @Transactional method is called from within the same class,…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

Why can using the default bean scope lead to issues in web applications?

The default singleton scope can lead to unintended shared state. In Spring, the default bean scope is singleton,…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

How does Spring Bean Validation prevent invalid data from reaching the service layer?

By using annotations like @Valid and @NotBlank in controllers. Spring Bean Validation allows you to annotate your controller…

View Card →