Bird
0
0

Which annotation is used in Spring AOP to wrap method execution for timing?

easy📝 Syntax Q12 of 15
Spring Boot - Aspect-Oriented Programming
Which annotation is used in Spring AOP to wrap method execution for timing?
A@Before
B@After
C@Around
D@Pointcut
Step-by-Step Solution
Solution:
  1. Step 1: Recall Spring AOP advice types

    @Before runs before method, @After runs after, @Around wraps method execution.
  2. Step 2: Identify which advice can measure execution time

    @Around can run code before and after method, so it can measure duration.
  3. Final Answer:

    @Around -> Option C
  4. Quick Check:

    @Around wraps method for timing [OK]
Quick Trick: Use @Around to wrap and time methods [OK]
Common Mistakes:
  • Using @Before or @After which can't measure duration
  • Confusing @Pointcut with advice annotation
  • Assuming @After runs before method

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes