This is the aspect class
public class TransactionAspect {
public void beforeAnything() throws IOException{
System.out.println("In the aspect");
}
public void beforeWithdrawalTransaction() throws IOException{
System.out.println("In the aspect");
}
public void beforeDepositTransaction() throws IOException{
System.out.println("In the aspect");
}
public void beforeBalance() throws IOException{
System.out.println("In the aspect");
}
}
This is the xml configuration file with my aspect I have tried different ways but still its not working
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
<aop:config>
<aop:pointcut id="forAnything" expression="execution(* com.pack.service.*.*(..))" />
<aop:advisor advice-ref="myAspectBean" pointcut="forAnything" id="interceptor" ></aop:advisor>
<aop:aspect id="myAspect" ref="myAspectBean">
<aop:before method="beforeWithdrawalTransaction" />
<aop:before method="beforeDepositTransaction" />
<aop:before method="beforeBalance"/>
</aop:aspect>
</aop:config>
<bean id="myAspectBean" class="com.pack.aspect.TransactionAspect"/>
</beans>
When I try to load my application, I get this error:
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Must define one of 'pointcut' or 'pointcut-ref' on <advisor> tag.
Offending resource: class path resource [Spring.xml]
Aspect: id='myAspect'
-> Advice (before)
I would advise you to add the property,pointcut-ref ="pointcut_id",to the tag