intermediateAsync Programming with @Async

Why return CompletableFuture instead of void from an @Async method?

A void @Async method is pure fire-and-forget — the caller has no way to know when it finished or get its result. Returning CompletableFuture<T> lets the caller compose multiple async calls together and retrieve the result once it's ready, without blocking immediately.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why is trusting a file's Content-Type header or extension as proof of what it actually is a security risk?← Back to all Spring Boot questions