I am trying to create a simple aspect . Here is my simple spring bean
public class SimpleService {
public void sayHello(){
System.out.println("hi");
}
}
Here is my aspect class
@Aspect
public class SimpleAspect {
@Before("execution(void sayHello())")
public void entering(){
System.out.println("entering..");
}
}
Here is my configuration file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns:aop="http://ift.tt/OpNdV1"
xsi:schemaLocation="http://ift.tt/OpNdV1 http://ift.tt/1oTOpwm
http://ift.tt/GArMu6 http://ift.tt/1jdM0fG">
<aop:aspectj-autoproxy/>
<bean id="service" class="com.schatt.service.SimpleService"></bean>
My understanding was that when I try to invoke SimpleService.sayHello() , the before aspect will be called and after that sayHello() will be called.But the aspect is not getting triggered.Can not understand what I am missing here.
Aucun commentaire:
Enregistrer un commentaire