Bird
0
0

Why does the pointcut expression execution(* com.example..*.*(..)) && !within(com.example.internal..*) exclude some methods?

hard📝 Conceptual Q10 of 15
Spring Boot - Aspect-Oriented Programming
Why does the pointcut expression execution(* com.example..*.*(..)) && !within(com.example.internal..*) exclude some methods?
AIt excludes all methods in the package com.example.internal and its subpackages
BIt excludes methods with private access modifier
CIt excludes methods not returning void
DIt excludes methods with no arguments
Step-by-Step Solution
Solution:
  1. Step 1: Understand the positive match

    execution(* com.example..*.*(..)) matches all methods in com.example package and subpackages.
  2. Step 2: Understand the negation with !within

    !within(com.example.internal..*) excludes all methods in the internal package and its subpackages.
  3. Final Answer:

    It excludes all methods in the package com.example.internal and its subpackages -> Option A
  4. Quick Check:

    Negation excludes internal package methods = It excludes all methods in the package com.example.internal and its subpackages [OK]
Quick Trick: Use !within() to exclude packages or classes [OK]
Common Mistakes:
  • Thinking it excludes methods by access modifier
  • Assuming it excludes by return type
  • Confusing argument count with exclusion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes