Spring MVC Basics
Spring MVC, MVC architecture, DispatcherServlet, @Controller, ViewResolver, Model-View-Controller pattern
1Which annotation transforms a Java class into a Spring MVC controller?
Which annotation transforms a Java class into a Spring MVC controller?
Cevap
@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.
2What is the main difference between @Controller and @RestController?
What is the main difference between @Controller and @RestController?
Cevap
@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.
3How to map a controller method to an HTTP POST request on /users URL?
How to map a controller method to an HTTP POST request on /users URL?
Cevap
@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.
How to retrieve a path variable from a URL like /users/{id}?
Which annotation to use to automatically deserialize JSON from HTTP request body?
+17 mülakat soruları
Diğer Spring Boot mülakat konuları
Spring Core - IoC & DI
Spring Boot Auto-Configuration
Spring Boot Starters
Application Properties & YAML
Logging with SLF4J & Logback
Spring Boot DevTools
Spring REST Controllers
Request & Response Handling
Exception Handling
Bean Validation
Spring Data JPA Basics
JPA Entities & Relationships
JPA Queries
Spring Data Repositories
Spring Security Basics
Spring Boot Actuator
Unit Testing with JUnit & Mockito
Spring Boot Testing
Profiles & Environment
RestTemplate & WebClient
Async & Scheduling
Caching with Spring
Spring WebFlux (Reactive)
Spring Transactions
Advanced Authentication & Authorization
JWT & Stateless Security
OAuth2 & Authorization Server
Spring Boot & Docker
Microservices with Spring
Spring Cloud Config
Performance Optimization
GraalVM Native Images
Bir sonraki mülakatın için Spring Boot'de uzmanlaş
Tüm sorulara, flashcards'a, teknik testlere, code review alıştırmalarına ve mülakat simülatörlerine eriş.
Ücretsiz başla