A Join Point is a concept from Aspect-Oriented Programming (AOP).
A Join Point is a specific point during the execution of program code where additional behavior (called an aspect) can be inserted.
Method calls
Method executions
Field access (read/write)
Exception handling
In AOP, cross-cutting concerns (like logging, security, or transaction management) are separated from the main business logic. These concerns are applied at defined points in the program flow — the Join Points.
Pointcut: A way to specify which Join Points should be affected (e.g., "all methods starting with save
").
Advice: The actual code that runs at a Join Point (e.g., "log this method call").
Aspect: A combination of Pointcut(s) and Advice(s) — the full module that implements a cross-cutting concern.
@Before("execution(* com.example.service.*.*(..))")
public void logBeforeMethod(JoinPoint joinPoint) {
System.out.println("Calling method: " + joinPoint.getSignature().getName());
}
→ This logs a message before every method call in a specific package. The joinPoint.getSignature()
call provides details about the actual Join Point.
Aspect-Oriented Programming (AOP) is a programming paradigm focused on modularizing cross-cutting concerns—aspects of a program that affect multiple parts of the codebase and don't fit neatly into object-oriented or functional structures.
Typical cross-cutting concerns include logging, security checks, error handling, transaction management, or performance monitoring. These concerns often appear in many classes and methods. AOP allows you to write such logic once and have it automatically applied where needed.
Aspect: A module that encapsulates a cross-cutting concern.
Advice: The actual code to be executed (e.g., before, after, or around a method call).
Join Point: A point in the program flow where an aspect can be applied (e.g., method execution).
Pointcut: A rule that defines which join points are affected (e.g., "all methods in class X").
Weaving: The process of combining aspects with the main program code—at compile-time, load-time, or runtime.
@Aspect
public class LoggingAspect {
@Before("execution(* com.example.service.*.*(..))")
public void logBeforeMethod(JoinPoint joinPoint) {
System.out.println("Calling method: " + joinPoint.getSignature().getName());
}
}
This code automatically logs a message before any method in the com.example.service
package is executed.
Improved modularity
Reduced code duplication
Clear separation of business logic and system-level concerns
Can reduce readability (the flow isn't always obvious)
Debugging can become more complex
Often depends on specific frameworks (e.g., Spring, AspectJ)