Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Persistence and Validation

Front

Why is early input rejection important in Spring applications?

It prevents invalid data from reaching the service layer. Early input rejection, using annotations like @Valid, stops invalid…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

How to handle transactions in self-invoking methods?

Use external calls or AOP to manage transactions. When a method within the same class calls another @Transactional…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

What are the benefits of constructor injection in Spring?

Constructor injection promotes immutability and easy testing. Constructor injection in Spring is preferred because it allows for immutable…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

Why can self-invocation of a @Transactional method fail?

Self-invocation bypasses the proxy, preventing transaction management. In Spring, @Transactional uses proxies to manage transactions. If a method…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

How does the @NotBlank annotation help in data validation?

@NotBlank ensures a string field is not null or empty. The @NotBlank annotation is used in Java Bean…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

Why does @Valid in Spring Boot controllers matter in this design?

@Valid triggers validation of the request body against defined constraints. By placing @Valid on a method parameter in…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

How does Java Bean Validation work in a Spring controller?

Java Bean Validation ensures input meets certain constraints before processing. In Spring, you can use annotations like @Valid…

View Card →
Flashcard Study

Java: Persistence and Validation

Front

Why validate request DTOs at the controller boundary?

So malformed input is rejected before it spreads into the service layer. Validation is strongest at the edge…

View Card →
Flashcard Study

Java: Inversion of Control (IoC)

Front

How does Spring Boot solve transaction self-invocation issues?

By using proxies to handle transaction boundaries. Transaction self-invocation occurs when a method within the same class calls…

View Card →
Flashcard Study

Java: Inversion of Control (IoC)

Front

Why does Spring Boot handle object instantiation through the Application Context?

It centralizes and manages object creation for consistency and ease. In large applications, managing object lifecycles and dependencies…

View Card →