Java: DTOs and Entities
Why might self-invocation fail for @Transactional methods in Spring Boot?
Spring's proxy mechanism doesn't intercept self-invocations. When a method calls another method of the same class, the call…
View Card →Quick study sessions to strengthen memory and retain key concepts.
Why might self-invocation fail for @Transactional methods in Spring Boot?
Spring's proxy mechanism doesn't intercept self-invocations. When a method calls another method of the same class, the call…
View Card →Why is directly exposing JPA entities in a REST API risky in production code?
It can lead to unwanted data exposure and security issues. Directly exposing entities can inadvertently reveal sensitive fields…
View Card →Why do teams use DTOs in Spring Boot in production code?
DTOs decouple API representation from the database schema. Using DTOs helps maintain a clear separation between how data…
View Card →How do DTOs support API versioning?
DTOs allow evolving API responses independently of the database. DTOs provide a way to manage API changes over…
View Card →Why avoid exposing the password field in APIs?
Exposing passwords is a major security risk. Exposing password fields in API responses can lead to severe security…
View Card →When should Prototype scope be used over Singleton in Spring?
For components that need a new instance per use. Prototype scope is suitable for beans that need a…
View Card →How do Proxy objects work in Spring AOP?
They wrap around beans to add cross-cutting functionalities. Proxy objects in Spring AOP wrap around target beans to…
View Card →How would you explain the design consequence of using DTOs in an interview?
DTOs add a layer of abstraction between the API and persistence layer. Using DTOs introduces a design layer…
View Card →Why can self-invocation fail for @Transactional methods?
Spring AOP proxies don't intercept self-invocations. In Spring, transactional behavior is applied through AOP proxies. These proxies only…
View Card →What's a common mistake with Bean scopes in Spring?
Using Singleton scope for stateful beans. Frame the concept in practical terms so you can explain it during…
View Card →