- In Java: Use layered architecture: @RestController for request/response handling, @Service for business logic delegating to @Repository for data access.
- Employ DTOs for API endpoints; map entities to/from DTOs using custom utilities in services.
- Prefer constructor injection for dependency injection.
- Apply @Transactional at the service layer, not repositories.
- Handle exceptions globally with @ControllerAdvice.
- In Java: Use `@RestController` with `@RequestMapping("/api/v1/users")` for RESTful endpoints — return `ResponseEntity<T>` for typed responses with status codes.
- Inject dependencies with constructor injection: `public UserService(UserRepository repo)` — Spring auto-wires single-constructor beans.
- Use `@Transactional` on service methods for database transaction management — set `readOnly = true` on query-only methods.
- Configure properties with `@ConfigurationProperties(prefix = "app")` bound to a record: `record AppConfig(String name, int port) {}`.