2V0-72.22PSE · Question #79
Which two statements are true about Spring AOP? (Choose two.)
The correct answer is A. The @After advice type is invoked regardless of whether a method successfully returned or an D. Examples of cross-cutting concerns include security, caching, transaction. A is correct because @After behaves like a finally block - it fires after the method exits whether it returned normally or threw an exception. It is distinct from @AfterReturning (success only) and @AfterThrowing (exception only). D is correct because security, caching, and…
Question
Which two statements are true about Spring AOP? (Choose two.)
Options
- AThe @After advice type is invoked regardless of whether a method successfully returned or an
- BIn Spring AOP, a join point represents a method execution or property access.
- CSpring AOP does not use AspectJ's pointcut expression language.
- DExamples of cross-cutting concerns include security, caching, transaction.
- EThere are in total 4 types of advice, @Before, @After, @AfterReturning and @AfterThrowing.
How the community answered
(37 responses)- A92% (34)
- C5% (2)
- E3% (1)
Explanation
A is correct because @After behaves like a finally block - it fires after the method exits whether it returned normally or threw an exception. It is distinct from @AfterReturning (success only) and @AfterThrowing (exception only).
D is correct because security, caching, and transaction management are the canonical textbook examples of cross-cutting concerns - functionality that spans multiple unrelated classes and is exactly what AOP is designed to modularize.
B is wrong because Spring AOP only supports method execution join points. Property access join points exist in full AspectJ but are not supported in Spring AOP's proxy-based model.
C is wrong - the opposite is true. Spring AOP does use AspectJ's pointcut expression language (e.g., execution(* com.example.*.*(..))) even though it doesn't use AspectJ's weaving mechanism.
E is wrong because there are 5 advice types, not 4 - the list omits @Around, which is the most powerful type as it can control whether the target method executes at all.
Memory tip: Think of the advice types with the acronym BAAART - Before, After, AfterReturning, AfterThrowing, aRound (5 total). For @After, picture a Java finally block - it always runs regardless of outcome.
Topics
Community Discussion
No community discussion yet for this question.