读书人

spring容易aop切面示例

发布时间: 2013-04-20 19:43:01 作者: rapoo

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); }}

读书人网 >行业软件

热点推荐