Bird
0
0

What will the pointcut expression execution(* *(..)) && within(com.example.repository..*) match?

medium📝 Predict Output Q5 of 15
Spring Boot - Aspect-Oriented Programming
What will the pointcut expression execution(* *(..)) && within(com.example.repository..*) match?
AAll constructors in com.example.repository package
BAll methods in any class within com.example.repository package and its subpackages
COnly methods named '*' in com.example.repository package
DAll methods in any package except com.example.repository
Step-by-Step Solution
Solution:
  1. Step 1: Understand execution(* *(..))

    This matches all methods with any name and any arguments.
  2. Step 2: Understand within(com.example.repository..*)

    This restricts matching to classes within the package and its subpackages.
  3. Final Answer:

    All methods in any class within com.example.repository package and its subpackages -> Option B
  4. Quick Check:

    All methods inside package and subpackages = All methods in any class within com.example.repository package and its subpackages [OK]
Quick Trick: Combine execution() and within() to limit package scope [OK]
Common Mistakes:
  • Confusing within() with execution()
  • Assuming it matches constructors
  • Misunderstanding subpackage matching with ..

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes