AOP Terminology — Spring Technical Interview Questions & Answers
Aspect, Advice, Pointcut, Join point and Weaving.
AOP Terminology
- AOP has a few words you should know cold for interviews.
- Aspect: the module that holds the extra behaviour.
- Advice: when/what to run (before, after, around).
- Join point: a point during execution (usually a method call in Spring).
- Pointcut: the expression that selects which join points.
- Weaving: attaching the aspect to the target.
- Recite aspect, advice, pointcut, join point in order.
Technical Interview Tip: 4 terms in 20 seconds.
Code Examples for AOP Terminology
AOP Terminology — working example
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
@Aspect
@Component
class TimingAspect {
@Before("execution(* com.example.service..*(..))")
void beforeService() {
System.out.println("service method called");
}
}AOP Terminology — aOP attaches cross-cutting advice (logging, timing) to pointcuts without cluttering business methods.
How to Explain AOP Terminology to an Interviewer
What is AOP Terminology?
Used for log every service call OrderService Not just the heading
Give one small example of AOP Terminology.
@Aspect + @Around Aspect, Advice, Pointcut, Join point and Weaving
What mistake do beginners make with AOP Terminology?
huge pointcuts that wrap everything Show the fix
Where do you use AOP Terminology?
OrderService log every service call