Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Controllers, Services, Repositories

Front

What belongs in the service layer during a checkout request?

Coordinating the business workflow across controllers, repositories, and integrations. The service layer is where use-case logic lives. It…

View Card →
Flashcard Study

Java: Bean Scope

Front

Why should service beans avoid stateful variables?

Stateful variables can cause data inconsistency. Service beans are typically Singleton and shared across threads. Stateful variables can…

View Card →
Flashcard Study

Java: Bean Scope

Front

How can you manage Prototype beans in a Singleton?

Use a method to inject new Prototype instances. Injecting a Prototype bean directly into a Singleton can lead…

View Card →
Flashcard Study

Java: Bean Scope

Front

What issues arise from transaction self-invocation?

Transactional behavior is not applied to internal method calls. When a transaction-managed method calls another method in the…

View Card →
Flashcard Study

Java: Bean Scope

Front

How does Constructor Injection support immutability?

Constructor Injection ensures dependencies are set at creation, supporting immutability. Constructor Injection mandates dependencies be provided during object…

View Card →
Flashcard Study

Java: Bean Scope

Front

Why is method-scope variable usage safe in a Singleton bean?

Method-scope variables are thread-confined and not shared across requests. Variables declared within a method reside in the stack…

View Card →
Flashcard Study

Java: Bean Scope

Front

What risks do stateful variables in a Singleton service pose?

They can lead to inconsistent state in a multithreaded environment. Stateful variables in a Singleton can be accessed…

View Card →
Flashcard Study

Java: Bean Scope

Front

Why is Singleton the default scope in Spring?

Singleton scope ensures a single instance per Spring container. Singleton is the default because it is efficient for…

View Card →
Flashcard Study

Java: Bean Scope

Front

What scope should be used for beans that maintain state specific to a user's session?

Session scope. Frame the concept in practical terms so you can explain it during interview discussion. Session scope…

View Card →
Flashcard Study

Java: Bean Scope

Front

Why is it important to manage state within a Singleton bean carefully?

To avoid concurrency issues. Frame the concept in practical terms so you can explain it during interview discussion.…

View Card →