File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -261,8 +261,7 @@ public class JdkProxyFactory {
261261** 5.实际使用**
262262
263263``` java
264- DebugProxy debugProxy = new DebugProxy (new SmsServiceImpl ());
265- SmsService smsService = debugProxy. getProxy(SmsService . class);
264+ SmsService smsService = (SmsService ) JdkProxyFactory . getProxy(new SmsServiceImpl ());
266265smsService. send(" java" );
267266```
268267
@@ -420,4 +419,4 @@ after method send
420419
421420这篇文章中主要介绍了代理模式的两种实现:静态代理以及动态代理。涵盖了静态代理和动态代理实战、静态代理和动态代理的区别、JDK 动态代理和 Cglib 动态代理区别等内容。
422421
423- 文中涉及到的所有源码,你可以在这里找到:[ https://github.com/Snailclimb/guide-rpc-framework-learning/tree/master/src/main/java/github/javaguide/proxy ] ( https://github.com/Snailclimb/guide-rpc-framework-learning/tree/master/src/main/java/github/javaguide/proxy ) 。
422+ 文中涉及到的所有源码,你可以在这里找到:[ https://github.com/Snailclimb/guide-rpc-framework-learning/tree/master/src/main/java/github/javaguide/proxy ] ( https://github.com/Snailclimb/guide-rpc-framework-learning/tree/master/src/main/java/github/javaguide/proxy ) 。
You can’t perform that action at this time.
0 commit comments