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 та симуляторів співбесід.

Почни безкоштовно