package com.xgj.aop.spring.advisor.aspectJ.function;
public interface Waiter {
public void greetTo(String clientName);
public void serverTo(String clientName);
}
接口实现类 两个NaiveWaiter 和 NaughtWaiter
package com.xgj.aop.spring.advisor.aspectJ.function;
public class NaiveWaiter implements Waiter {
@NeedTest(true)
@Override
public void greetTo(String clientName) {
System.out.println("NaiveWaiter:greet to " + clientName);
}
@Override
public void serverTo(String clientName) {
System.out.println("NaiveWaiter:server to " + clientName);
}
public void smile(String clientName, int times) {
System.out.println("NaiveWaiter:smile to " + clientName + " " + times
+ " times");
}
}
package com.xgj.aop.spring.advisor.aspectJ.function;
public class NaughtWaiter implements Waiter {
@Override
public void greetTo(String clientName) {
System.out.println("NaughtWaiter:greet to " + clientName);
}
@NeedTest(true)
@Override
public void serverTo(String clientName) {
System.out.println("NaughtWaiter:server to " + clientName);
}
public void joke(String clientName, int times) {
System.out.println("NaughtyWaiter:play " + times + " jokes to "
+ clientName);
}
}
2017-08-27 01:24:22,551 INFO [main] (AbstractApplicationContext.java:583) - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6ac604: startup date [Sun Aug 27 01:24:22 BOT 2017]; root of context hierarchy
2017-08-27 01:24:22,647 INFO [main] (XmlBeanDefinitionReader.java:317) - Loading XML bean definitions from class path resource [com/xgj/aop/spring/advisor/aspectJ/function/annotationFun/conf-annotation.xml]
NaiveWaiter:greet to XiaoGongJiang
needTest() executed,some logic is here
NaiveWaiter:server to XiaoGongJiang
NaughtWaiter:server to XiaoGongJiang
needTest() executed,some logic is here