Recall & Review
beginner
What is AOP in Spring Boot?
AOP stands for Aspect-Oriented Programming. It helps separate cross-cutting concerns like logging from business logic by using aspects.
Click to reveal answer
beginner
What is an Aspect in AOP?
An Aspect is a class that contains advice (code) to be executed at certain points in the program, like before or after method calls.Click to reveal answer
beginner
What is a Join Point in AOP?
A Join Point is a specific point in the program execution, such as a method call, where an aspect can be applied.
Click to reveal answer
beginner
What is Advice in AOP?
Advice is the action taken by an aspect at a particular join point, like running logging code before or after a method.
Click to reveal answer
intermediate
How do you define a pointcut for logging all methods in a package?
Use @Pointcut with an expression like "execution(* com.example.package..*(..))" to match all methods in that package and subpackages.
Click to reveal answer
What annotation marks a class as an Aspect in Spring Boot?
✗ Incorrect
The @Aspect annotation tells Spring that the class contains AOP advice.
Which advice runs before a method execution?
✗ Incorrect
@Before advice runs before the target method starts.
What does the pointcut expression "execution(* *(..))" mean?
✗ Incorrect
This expression matches all methods regardless of name, return type, or parameters.
Which advice can control whether the target method executes or not?
✗ Incorrect
@Around advice wraps the method call and can decide to proceed or skip it.
What is the main benefit of using AOP for logging?
✗ Incorrect
AOP keeps logging code separate, making the main code easier to read and maintain.
Explain how you would use AOP in Spring Boot to log method calls in a service class.
Think about where to put the logging code so it runs automatically before or around methods.
You got /4 concepts.
Describe the difference between @Before and @Around advice in AOP logging.
Consider which advice can skip the method execution.
You got /3 concepts.