Bird
0
0

Which of the following is the correct syntax to define an Around advice method in Spring AOP?

easy📝 Syntax Q3 of 15
Spring Boot - Aspect-Oriented Programming
Which of the following is the correct syntax to define an Around advice method in Spring AOP?
Apublic Object monitor(ProceedingJoinPoint pjp) throws Throwable
Bpublic Object monitor(JoinPoint jp)
Cpublic void monitor(JoinPoint jp)
Dpublic void monitor(ProceedingJoinPoint pjp) throws Throwable
Step-by-Step Solution
Solution:
  1. Step 1: Recall Around advice method signature

    Around advice must return Object and accept ProceedingJoinPoint to proceed with method execution.
  2. Step 2: Match signature with options

    Only public Object monitor(ProceedingJoinPoint pjp) throws Throwable matches return type Object and parameter ProceedingJoinPoint with throws Throwable.
  3. Final Answer:

    public Object monitor(ProceedingJoinPoint pjp) throws Throwable -> Option A
  4. Quick Check:

    Around advice signature = Object return + ProceedingJoinPoint param [OK]
Quick Trick: Around advice returns Object and uses ProceedingJoinPoint [OK]
Common Mistakes:
  • Using void return type for Around advice
  • Using JoinPoint instead of ProceedingJoinPoint
  • Omitting throws Throwable declaration

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes