读书人

Spring - 施用MethodInterceptor实现A

发布时间: 2012-09-16 17:33:17 作者: rapoo

Spring -- 使用MethodInterceptor实现AOP
.1. 先写出业务对象接口及实现业务对象。





1.public class Main {   2.  3.    /**  4.     *   5.     * @param args  6.     */  7.    public static void main(String[] args) {   8.        ClassPathResource resource = new ClassPathResource("spring.xml");   9.        XmlBeanFactory beanFactory = new XmlBeanFactory(resource);   10.        Interface bean = (Interface)beanFactory.getBean("bean");   11.        bean.hello();   12.           13.        Interface testBean = (Interface)beanFactory.getBean("testBean");   14.        testBean.hello();   15.    }   16.} 


读书人网 >编程

热点推荐