Explain the role of the @Async annotation in Spring Framework.

The @Async annotation in Spring lets a method execute on a separate thread rather than the caller's thread, enabling non-blocking, fire-and-forget or background processing within an otherwise synchronous application.

Key Points: • Requires @EnableAsync on a configuration class to activate asynchronous method proxying. • The annotated method runs through a TaskExecutor-backed thread pool instead of blocking the caller. • Return types are typically void for fire-and-forget work, or Future/CompletableFuture when the caller needs the result later. • Exceptions thrown inside a void @Async method are not propagated to the caller and must be handled with an AsyncUncaughtExceptionHandler. • @Async only works on Spring-managed beans and doesn't take effect for internal method calls within the same class due to proxy-based AOP.

Example: A user registration flow calls an @Async-annotated method to send a welcome email, so the HTTP response returns to the client immediately while the email is sent on a background thread.

Interview Tip: A concise interview answer is:

"@Async offloads a method to a background thread so the caller doesn't block waiting for it, which I use for things like sending notifications or processing large datasets. It requires @EnableAsync, and I return a CompletableFuture when the caller actually needs to know the outcome."