Spring Boot

Spring MVC Basics

Spring MVC, MVC architecture, DispatcherServlet, @Controller, ViewResolver, Model-View-Controller pattern

20 คำถามสัมภาษณ์·
Mid-Level
1

Which annotation transforms a Java class into a Spring MVC controller?

คำตอบ

@Controller marks a class as a Spring MVC controller that handles HTTP requests. It is a specialization of @Component and allows component scanning to automatically detect the controller. @RestController combines @Controller and @ResponseBody for REST APIs, while @RequestMapping defines URL mappings but doesn't declare a controller by itself.

2

What is the main difference between @Controller and @RestController?

คำตอบ

@RestController combines @Controller and @ResponseBody, meaning all methods automatically return serialized data (JSON/XML) instead of view names. With @Controller, you must add @ResponseBody to each method to return data. @RestController is designed for REST APIs, while @Controller is used for traditional web applications with view rendering.

3

How to map a controller method to an HTTP POST request on /users URL?

คำตอบ

@PostMapping is the specialized annotation for mapping a method to POST requests on a specific URL. It's a shortcut for @RequestMapping(method = RequestMethod.POST). Other specialized annotations include @GetMapping, @PutMapping, @DeleteMapping, and @PatchMapping. This approach is more readable and concise than @RequestMapping with method attribute.

4

How to retrieve a path variable from a URL like /users/{id}?

5

Which annotation to use to automatically deserialize JSON from HTTP request body?

+17 คำถามสัมภาษณ์

หัวข้อสัมภาษณ์ Spring Boot อื่นๆ

Spring Core - IoC & DI

Junior
22 คำถาม

Spring Boot Auto-Configuration

Junior
20 คำถาม

Spring Boot Starters

Junior
18 คำถาม

Application Properties & YAML

Junior
16 คำถาม

Logging with SLF4J & Logback

Junior
20 คำถาม

Spring Boot DevTools

Junior
15 คำถาม

Spring REST Controllers

Mid-Level
20 คำถาม

Request & Response Handling

Mid-Level
20 คำถาม

Exception Handling

Mid-Level
25 คำถาม

Bean Validation

Mid-Level
25 คำถาม

Spring Data JPA Basics

Mid-Level
25 คำถาม

JPA Entities & Relationships

Mid-Level
30 คำถาม

JPA Queries

Mid-Level
30 คำถาม

Spring Data Repositories

Mid-Level
25 คำถาม

Spring Security Basics

Mid-Level
25 คำถาม

Spring Boot Actuator

Mid-Level
20 คำถาม

Unit Testing with JUnit & Mockito

Mid-Level
30 คำถาม

Spring Boot Testing

Mid-Level
30 คำถาม

Profiles & Environment

Mid-Level
20 คำถาม

RestTemplate & WebClient

Mid-Level
24 คำถาม

Async & Scheduling

Mid-Level
25 คำถาม

Caching with Spring

Mid-Level
25 คำถาม

Spring WebFlux (Reactive)

Mid-Level
25 คำถาม

Spring Transactions

Senior
30 คำถาม

Advanced Authentication & Authorization

Senior
30 คำถาม

JWT & Stateless Security

Senior
20 คำถาม

OAuth2 & Authorization Server

Senior
20 คำถาม

Spring Boot & Docker

Senior
19 คำถาม

Microservices with Spring

Senior
25 คำถาม

Spring Cloud Config

Senior
19 คำถาม

Performance Optimization

Senior
30 คำถาม

GraalVM Native Images

Senior
20 คำถาม

เชี่ยวชาญ Spring Boot สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี