The formal unbound in pointcut exception also occurs for two resons in AOP.
Reason 1: If there are no return statement in after returning advice
For XML based implementation
<aop:aspect id="myaspect" ref="trackAspect">
<aop:pointcut id="pointCutAfterReturning" expression="execution(* com.springlearn.Operation.*(..))" />
<aop:after-returning method="myAdvice" returning="result" pointcut-ref="pointCutAfterReturning"/> //Make sure returning result is added
</aop:aspect>
For Annotation based implementation
@AfterReturning(
pointcut = "execution(* Operation.*(..))",
returning= "result") //Make sure returning result is added
Reason 2: If there is no throwing in After throwing Advice
For XML based implementation
<aop:aspect id="myaspect" ref="trackAspect" >
<!-- @AfterThrowing -->
<aop:pointcut id="pointCutAfterThrowing" expression="execution(* com.javatpoint.Operation.*(..))" />
<aop:after-throwing method="myadvice" throwing="error" pointcut-ref="pointCutAfterThrowing" /> //Make sure throwing error is added
</aop:aspect>
For Annotation based Implementation
@AfterThrowing(
pointcut = "execution(* Operation.*(..))",
throwing= "error") //Make sure throwing error is added