Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: DTOs and Entities

Front

Why is constructor injection favored in Spring Boot?

It ensures immutability and clear dependencies. Constructor injection is preferred because it makes the dependencies of a class…

View Card →
Flashcard Study

Java: DTOs and Entities

Front

What are the consequences of serialization boundaries in Spring?

They define what data gets serialized and sent over the network. Serialization boundaries determine the data that is…

View Card →
Flashcard Study

Java: DTOs and Entities

Front

How do DTOs help prevent sensitive data leaks?

DTOs allow control over what data is exposed. By using DTOs, you can selectively include or exclude fields…

View Card →
Flashcard Study

Java: DTOs and Entities

Front

What role do DTOs play in a Spring Boot application?

DTOs separate the API representation from the database schema. Data Transfer Objects (DTOs) are used to transfer data…

View Card →
Flashcard Study

Java: DTOs and Entities

Front

Why is it a risk to expose database Entities in a Spring API?

Entities expose internal data structures and sensitive information. Exposing database entities directly in APIs can reveal the internal…

View Card →
Flashcard Study

Java: DTOs and Entities

Front

Why return DTOs from controllers instead of exposing entities directly?

DTOs keep the public API separate from internal persistence details and sensitive fields. Entities are shaped by database…

View Card →
Flashcard Study

Java: Controllers, Services, Repositories

Front

How does transaction self-invocation affect method calls in a @Service class?

It can bypass transaction management. Frame the concept in practical terms so you can explain it during interview…

View Card →
Flashcard Study

Java: Controllers, Services, Repositories

Front

What are the benefits of using constructor injection in Spring Boot?

Constructor injection ensures immutability and easier testing. Constructor injection requires dependencies to be provided at object creation, promoting…

View Card →
Flashcard Study

Java: Controllers, Services, Repositories

Front

Why is it important to separate concerns across @RestController, @Service, and @Repository in Spring?

It promotes modularity and maintainability. Separating concerns ensures that each layer of your application has a distinct responsibility:…

View Card →
Flashcard Study

Java: Controllers, Services, Repositories

Front

How would you explain the use of @ComponentScan in a Spring Boot application in an interview?

To detect and register beans automatically. @ComponentScan tells Spring where to look for components like @Service, @Repository, and…

View Card →