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.}