spring简单aop切面示例
spirng简单AOP切面示例
配置文件:
切面类:
测试类:public class TestAop {/** * @param args */@SuppressWarnings("deprecation")public static void main(String[] args) {// TODO Auto-generated method stubApplicationContext ac = new FileSystemXmlApplicationContext("src/applicationContext.xml"); IService aService = (IService) ac.getBean("aService"); IService bService = (IService) ac.getBean("bService"); System.out.println("开始调用aService方法"); aService.foo("hello", 0); System.out.println("--------------------"); System.out.println("开始调用bService方法"); bService.foo("world", 1); }}