Async & Scheduling
Async execution with @Async, scheduling with @Scheduled, ThreadPoolTaskExecutor, time management
1Which annotation makes a method asynchronous in Spring?
Which annotation makes a method asynchronous in Spring?
Risposta
@Async marks a method for asynchronous execution. Spring executes this method in a separate thread via a TaskExecutor. Requires @EnableAsync on a configuration class to enable the mechanism. Useful for long operations (email sending, file processing) without blocking the main thread. Method can return void, Future or CompletableFuture.
2Which annotation enables support for @Async methods in Spring?
Which annotation enables support for @Async methods in Spring?
Risposta
@EnableAsync activates processing of @Async annotations. It must be placed on a @Configuration class. Without this annotation, @Async is ignored and methods execute synchronously.
3Which legacy return type allows retrieving the result of an @Async method?
Which legacy return type allows retrieving the result of an @Async method?
Risposta
Future<T> is the historical return type for async methods. Allows retrieving the result via future.get() (blocking). CompletableFuture<T> is now preferred for its functional programming and better composition.
What is the main advantage of CompletableFuture over Future for @Async methods?
What is AsyncResult used for in Spring?
+22 domande da colloquio
Altri argomenti di colloquio Spring Boot
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
RestTemplate & WebClient
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
Padroneggia Spring Boot per il tuo prossimo colloquio
Accedi a tutte le domande, flashcards, test tecnici, esercizi di code review e simulatori di colloquio.
Inizia gratis