Cheat Sheet for Java
Multithreading
Threads = parallel tasks
Mutexes = one-at-a-time guards
Deadlocks = things to avoid with care
SpringBoot
How would you secure a REST API in Spring Boot? What layers do you touch?
1. Transport Layer Security (HTTPS) (SSL/TLS (HTTPS))
2. Authentication (Basic Auth, OAuth2, JWT (JSON Web Tokens), or API keys)
3. Authorization (Roles — Only admin, users)
4. Validation and Protection Against Injection ((Spring’s validation annotations) and parameterized queries to mitigate SQL injection)
5. Error Handling and Information Exposure (Don’t leak sensitive implementation details in error responses)
6. Monitoring and Logging
Get Uday J’s stories in your inbox
Join Medium for free to get updates from this writer.
Design a microservice to handle user notifications. What would your architecture look like?
1.**Event Trigger & Message Broker (e.g., Kafka, RabbitMQ, AWS SNS).
2. **Notification Microservice (Core Backend)
3. **Channel Delivery Workers/Providers
3.1 Email (SMTP or 3rd-party provider integration)
3.2 SMS (provider integration)
3.3 Push notifications (mobile/web via FCM/APNs)
3.4 In-app/WebSocket notifications (real-time delivery)
4. **API Endpoints
5. **Monitoring, Logging, & Analytics
How do you manage configuration across environments (dev, staging, prod)?
1.Externalized Configuration (e.g., application-dev.properties, application-prod.properties in Spring)
2.Centralized Configuration Management (Spring Cloud Config, Kubernetes ConfigMaps, AWS Systems)
3.Version Control & GitOps
4.CI/CD Integration (GitLab CI, Jenkins, GitHub Actions)
5.Standardize Naming & Structure (Consistent variable/property naming across environments prevents confusion and errors)
What are common mistakes developers make in REST API design? How do you avoid them?
1. Improper Use of URIs (e.g., /getUsers, /createOrder)
2. Incorrect Use of HTTP Methods (POST, GET, PUT, DELETE, and PATCH)
3. Inconsistent or Ambiguous Naming and Structure (/users, /orders)
4. Ignoring Error Handling and Status Codes (e.g., 200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Internal Server Error)
5. Lack of Documentation
6. Skipping Testing & Monitoring









