RestTemplate & WebClient
HTTP calls with RestTemplate (synchronous) and WebClient (reactive), error handling, interceptors
1What is the status of RestTemplate in recent Spring versions?
What is the status of RestTemplate in recent Spring versions?
Cevap
RestTemplate has been in maintenance mode since Spring 5 and is no longer actively developed. Spring recommends using WebClient, a more modern and performant non-blocking reactive API. RestTemplate remains supported for compatibility with existing code, but new projects should prefer WebClient.
2Which RestTemplate method returns only the response body?
Which RestTemplate method returns only the response body?
Cevap
getForObject directly returns the deserialized object from the HTTP response body, without metadata (status, headers). This method is convenient for simple cases where only data is needed. To access headers or HTTP status, use getForEntity which returns a complete ResponseEntity.
3Which RestTemplate method allows access to the HTTP status and response headers?
Which RestTemplate method allows access to the HTTP status and response headers?
Cevap
getForEntity returns a ResponseEntity that encapsulates the response body, HTTP status code and headers. This method is useful when it's necessary to inspect response metadata, such as checking the status or reading a custom header. For simple cases where only the body is needed, getForObject is sufficient.
Which RestTemplate method offers the most control over the HTTP request?
Which component allows customization of HTTP error handling in RestTemplate?
+21 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 MVC Basics
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
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