代理模式详解:静态代理、JDK动态代理与Cglib动态代理 (3)

创建测试类CglibProxyTest

package com.rangers.proxy.cglibProxy; /** * @Author Rangers * @Description * @Date 2021-03-09 **/ public class CglibProxyTest { public static void main(String[] args) { // 目标对象 AccountService target = new AccountService(); // 创建代理对象,传入目标对象进行初始化 AccountService accountService = new AccountServiceCglibProxy(target).createProxy(); accountService.transfer(); accountService.getBalance(); } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zydspd.html