首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Spring JDK动态署理和使用CGLIB生成代理

2012-08-26 
Spring JDK动态代理和使用CGLIB生成代理package junit.testimport org.junit.Testimport cn.itcast.aop.

Spring JDK动态代理和使用CGLIB生成代理

package junit.test;import org.junit.Test;import cn.itcast.aop.CGlibProxyFactory;import cn.itcast.aop.JDKProxyFactory;import cn.itcast.service.PersonService;import cn.itcast.service.impl.PersonServiceBean;public class AOPTest {@Testpublic void jdkProxyTest() {JDKProxyFactory factory = new JDKProxyFactory();PersonService service = (PersonService) factory.createProxyIntance(new PersonServiceBean("xxx"));service.save("jdkProxyTest");}@Testpublic void cglibProxyTest() {CGlibProxyFactory factory = new CGlibProxyFactory();PersonServiceBean service = (PersonServiceBean) factory.createProxyIntance(new PersonServiceBean("xxx"));service.save("cglibProxyTest");}}

?

?

热点排行