Bird
0
0

Which Spring annotation must be used on a method to make it run asynchronously after enabling @EnableAsync?

easy📝 Conceptual Q2 of 15
Spring Boot - Async Processing
Which Spring annotation must be used on a method to make it run asynchronously after enabling @EnableAsync?
A@Transactional
B@Async
C@Scheduled
D@Cacheable
Step-by-Step Solution
Solution:
  1. Step 1: Identify the annotation for async methods

    Methods annotated with @Async run asynchronously when @EnableAsync is present.
  2. Step 2: Eliminate unrelated annotations

    @Scheduled is for scheduling, @Transactional for transactions, @Cacheable for caching.
  3. Final Answer:

    @Async -> Option B
  4. Quick Check:

    Async method annotation = @Async [OK]
Quick Trick: Mark methods with @Async to run them asynchronously [OK]
Common Mistakes:
  • Using @Scheduled instead of @Async
  • Forgetting to add @Async on methods
  • Confusing with transaction annotations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes