Spring Boot

Request & Response Handling

@PathVariable, @RequestParam, @RequestBody, @RequestHeader, content negotiation, JSON serialization

20 питань зі співбесід·
Mid-Level
1

Which annotation allows extracting a value from an HTTP header in a Spring MVC controller?

Відповідь

@RequestHeader allows extracting values from HTTP headers of the incoming request. This annotation automatically binds the value of a specific header to a method parameter. It supports type conversions and can be made optional with required=false. Useful for extracting authentication tokens, tracking information or client preferences like Accept-Language.

2

How to retrieve the value of a cookie named 'sessionId' in a controller method?

Відповідь

@CookieValue allows extracting the value of a specific HTTP cookie and binding it to a method parameter. The annotation accepts the cookie name as a parameter and supports automatic type conversions. It can also be marked as optional with required=false. Commonly used for session identifiers, user preferences or analytics tracking tokens.

3

Why is injecting HttpServletRequest directly into a controller method less optimal than using Spring MVC annotations?

Відповідь

Spring MVC annotations like @RequestParam, @RequestHeader or @PathVariable offer typed and automatic data extraction, with conversion and validation handling. Using HttpServletRequest directly requires manual parsing, makes code less readable and testable. Annotations also promote immutability and API contract clarity.

4

Which interface allows intercepting HTTP requests before they reach the controller in Spring MVC?

5

How to register a custom interceptor in a Spring MVC application?

+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 MVC Basics

Mid-Level
20 запитань

Spring REST Controllers

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

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