22 October 2020

#Spring_Rest

#Spring_Rest

Key Concepts


S.No Topic Sub-Topics
1 Introduction to REST What is REST?, REST Constraints, Resources, Stateless, Web Standards
2 HTTP Basics HTTP Methods, Status Codes, Headers, JSON, Idempotency
3 Spring Web MVC Basics DispatcherServlet, Controller, RequestMapping, ResponseBody, Model
4 Spring REST Architecture Controllers, Resources, Services, Repositories, Layers
5 Building REST API @RestController, Path Variables, Request Params, JSON Body, ResponseEntity
6 Request Handling @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, Content-Type
7 Data Binding @RequestBody, @ResponseBody, DTO, Validation, Conversion
8 Validation @Valid, Custom Validator, Constraint, Error Handling, Messages
9 Spring Data Integration JPA, Repository, Pagination, Sorting, Query Methods
10 CRUD API Create, Read, Update, Delete, Pagination
11 Exception Handling Global Exception, Custom Exceptions, @ControllerAdvice, Handler Methods, Response Structure
12 Response Structure Success/Failure, Meta Data, Error Codes, Hypermedia, JSON Formats
13 Spring Security Basics Authentication, Authorization, Filters, UserDetails, Password Encoding
14 JWT Integration Token Create, Validate, Expire, Refresh Token, Authorization Header
15 API Versioning URI Versioning, Header Versioning, Media Type Versioning, Best Practices, Backward Compatibility
16 HAL & HATEOAS Linking Resources, Hateoas Library, Hypermedia, Restful Navigation, Discoverability
17 Pagination & Filtering Pageable, Sort, Filters, Query Params, Page Metadata
18 Content Negotiation Accept Header, XML Support, JSON, Mime Types, Message Converters
19 File Upload/Download Multipart Form, Streaming, Large File, Storage, Headers
20 Logging & Monitoring Log Levels, MDC, HTTP Logs, DevTools, Actuator
21 RestTemplate GET, POST, PUT, Exchange, Interceptors
22 WebClient Reactive Client, Exchange, Retry, Timeout, Streaming
23 CORS Handling Allow Origin, Pre-flight, Headers, Config, Spring Boot
24 Cache for REST Cache-Control, ETag, Last-Modified, Redis Cache, TTL
25 Rate Limiting Bucket4j, API Gateway, Quotas, Retry After, Limits
26 Metrics & Observability Micrometer, Prometheus, Grafana, Trace ID, Span ID
27 API Documentation OpenAPI Spec, Swagger UI, Annotations, Example Values, Codegen
28 Deployment Strategies Docker Container, Reverse Proxy, Load Balancer, Cloud, SSL/TLS
29 Testing REST API JUnit, Mockito, WebMvcTest, MockMvc, Testcontainers
30 Final Project Full CRUD API, JWT Security, Pagination, Swagger, Docker

Interview question

Basic Level

  1. What is REST, and what does it stand for?
  2. What are the key principles of RESTful architecture?
  3. What are the main HTTP methods used in REST APIs?
  4. What is the difference between PUT and POST methods?
  5. What is idempotency in REST, and which methods are idempotent?
  6. What annotations are used to create RESTful web services in Spring?
  7. What is the purpose of @RestController in Spring?
  8. What is the difference between @Controller and @RestController?
  9. What does @RequestMapping do in Spring REST?
  10. How do you map different HTTP methods using annotations?
  11. What is the use of @PathVariable and @RequestParam?
  12. How do you handle JSON request and response in Spring REST?
  13. What is the role of @ResponseBody?
  14. What is ResponseEntity, and when should it be used?
  15. How do you return custom HTTP status codes from a REST endpoint?
  16. What is content negotiation in REST?
  17. What is the default format used by Spring REST for responses?
  18. How do you enable XML support in Spring REST?
  19. What is the function of HttpMessageConverter?
  20. What is the purpose of the @Valid annotation in REST APIs?
  21. What is a DTO in REST, and why is it used?
  22. How do you handle path variables with multiple values?
  23. How do you pass query parameters in a GET request?
  24. What is a REST client? Give examples in Spring.
  25. What are the main advantages of using RESTful APIs?

Intermediate Level

  1. What is exception handling in Spring REST?
  2. How do you use @ExceptionHandler for handling exceptions?
  3. What is @ControllerAdvice, and how does it work?
  4. How do you create a global error handler in Spring REST?
  5. What are the different HTTP status codes commonly used in REST APIs?
  6. How do you implement input validation using Spring Validator?
  7. How can you handle file uploads using Spring REST?
  8. How do you download files using Spring REST?
  9. What is the difference between @RequestBody and @ModelAttribute?
  10. What is CORS, and how do you enable it in Spring REST?
  11. How do you secure a REST API in Spring using Basic Authentication?
  12. How do you secure REST endpoints using JWT?
  13. How do you enable Swagger documentation in a Spring REST project?
  14. What is OpenAPI, and how does it relate to SpringDoc?
  15. How can you test REST endpoints using MockMvc?
  16. What is the use of RestTemplate in Spring?
  17. What are the drawbacks of RestTemplate compared to WebClient?
  18. What is WebClient, and how is it different from RestTemplate?
  19. How do you consume external APIs in Spring REST?
  20. How do you use query parameters with RestTemplate?
  21. What is the use of ResponseEntityExceptionHandler?
  22. How do you enable pagination and sorting in REST APIs?
  23. How do you handle validation errors in REST responses?
  24. What is @JsonIgnore used for in Spring REST?
  25. How do you implement a simple CRUD REST API in Spring Boot?

Advanced Level

  1. What is HATEOAS in Spring REST?
  2. What are the benefits of HATEOAS in RESTful APIs?
  3. How do you add links using RepresentationModel?
  4. What is the HAL format in Spring HATEOAS?
  5. How do you enable content negotiation for different clients?
  6. What are some common REST API design best practices?
  7. How do you handle versioning in REST APIs?
  8. What are the different approaches to versioning APIs in Spring?
  9. How do you implement custom exception responses?
  10. How do you log requests and responses in Spring REST?
  11. How do you implement a retry mechanism for failed REST calls?
  12. How do you implement caching in REST APIs?
  13. What is ETag, and how is it used for caching?
  14. How do you set custom HTTP headers in a response?
  15. How do you use filters or interceptors in Spring REST?
  16. What is the difference between a filter and an interceptor?
  17. How can you improve REST API performance?
  18. How do you implement rate limiting in Spring REST?
  19. What is Spring Data REST, and when should you use it?
  20. How does RepositoryRestResource work in Spring Data REST?
  21. What is the difference between Spring MVC and Spring WebFlux?
  22. How do you make asynchronous REST calls in Spring?
  23. What are functional endpoints in Spring WebFlux?
  24. How do you handle backpressure in reactive REST APIs?
  25. What are the pros and cons of using reactive programming in REST APIs?

Expert Level

  1. How do you design fault-tolerant REST services using Resilience4j?
  2. What is a circuit breaker, and how is it used in REST APIs?
  3. How do you use Retry and Fallback patterns in REST?
  4. How can you integrate Spring REST with an API Gateway?
  5. How do you handle distributed tracing across multiple REST services?
  6. What is Micrometer, and how do you use it to monitor REST endpoints?
  7. How do you integrate Prometheus or Grafana with Spring REST metrics?
  8. How can you log REST request latency and throughput?
  9. What are the strategies to avoid over-fetching and under-fetching in APIs?
  10. What is Richardson Maturity Model (RMM)?
  11. How do you achieve Level 3 of Richardson Maturity Model in REST?
  12. How do you handle long-running REST operations asynchronously?
  13. What is Server-Sent Events (SSE) in Spring?
  14. How do you implement SSE using Spring WebFlux?
  15. How can you implement an event-driven REST API?
  16. How do you design REST APIs for microservices communication?
  17. What is the difference between REST and GraphQL?
  18. How can REST and GraphQL coexist in a single application?
  19. How do you secure REST APIs using OAuth2 in Spring?
  20. What is token introspection, and how does it work in OAuth2?
  21. How do you manage role-based access control in REST APIs?
  22. How can you externalize API configurations using Config Server?
  23. How do you deploy Spring REST microservices in Kubernetes?
  24. What are the best practices for REST API logging and monitoring?
  25. How do you ensure backward compatibility in evolving REST APIs?

Related Topics