Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
Spring Boot 10 questions

Building REST APIs with Spring Boot

Design REST endpoints. Learn route mappings, request body mappings, JSON responses, status code configs, and controller validation.

More Spring Boot
Interview questions 1–10 of 10
1

What is @RestController and how is it different from @Controller?

@RestController is a convenience annotation that combines @Controller and @ResponseBody. It marks a class as a...

Read answer →
2

What are the common HTTP mapping annotations in Spring Boot (@GetMapping, @PostMapping, etc.)?

Spring Boot provides shorthand annotations for each HTTP method, all specializations of @RequestMapping: @GetM...

Read answer →
3

What is the difference between @PathVariable and @RequestParam?

@PathVariable extracts a value from the URI path itself, used when the value identifies a specific resource, e...

Read answer →
4

How do you validate request bodies in Spring Boot?

Spring Boot integrates with Bean Validation (JSR-380 / Jakarta Validation) via spring-boot-starter-validation....

Read answer →
5

How do you handle exceptions globally in Spring Boot using @ControllerAdvice?

@ControllerAdvice defines a global exception-handling component that applies across all controllers, keeping e...

Read answer →
6

What is ResponseEntity and when should you use it?

ResponseEntity represents the entire HTTP response — status code, headers, and body — giving full control over...

Read answer →
7

How does Jackson serialize and deserialize JSON in Spring Boot, and how do you customize it?

Spring Boot auto-configures Jackson's ObjectMapper as the default HTTP message converter, so any object return...

Read answer →
8

What is Content Negotiation in Spring Boot REST APIs?

Content negotiation is the process by which Spring determines the representation format (JSON, XML, etc.) to r...

Read answer →
9

How do you version a REST API in Spring Boot?

Common API versioning strategies in Spring Boot include URI versioning (/api/v1/users, /api/v2/users), request...

Read answer →
10

How do you document a Spring Boot REST API with OpenAPI/Swagger?

Spring Boot REST APIs are documented using springdoc-openapi (the modern successor to SpringFox), which scans...

Read answer →