JDK--Proxy代理&CGLIB代理
概述
代理模式主要有两种:静态代理和动态代理 
静态代理类图之间的关系
静态代理:比如要在输出“HelloWorld”前打印一个字符串“Welcome”
A:先定义一个接口类
package com.mypack.test;import org.junit.BeforeClass;import org.junit.Test;import com.mypack.aop.CGLIBProxyFactory;import com.mypack.aop.JDKProxyFactory;import com.mypack.service.PersonService;import com.mypack.service.impl.PersonServiceBean;public class Demo {@BeforeClasspublic static void setUpBeforeClass() throws Exception {}@Testpublic void testJDKProxySave() {JDKProxyFactory factory = new JDKProxyFactory();PersonService personService = (PersonService) factory.createProxyInstance(new PersonServiceBean("liudong"));personService.save();}@Testpublic void testCGLIBProxySave() {CGLIBProxyFactory factory = new CGLIBProxyFactory();PersonService personService = (PersonService) factory.createProxyInstance(new PersonServiceBean("liudong"));personService.save();}}