Skip to content

Commit

Permalink
jdk动态代理实际使用中,new DebugProxy()代码有误
Browse files Browse the repository at this point in the history
jdk动态代理实际使用中,new DebugProxy()代码有误
  • Loading branch information
erisonlan authored Aug 15, 2020
1 parent c254fce commit 218d095
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/java/basic/java-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ public class JdkProxyFactory {
**5.实际使用**

```java
DebugProxy debugProxy = new DebugProxy(new SmsServiceImpl());
SmsService smsService = debugProxy.getProxy(SmsService.class);
SmsService smsService = (SmsService) JdkProxyFactory.getProxy(new SmsServiceImpl());
smsService.send("java");
```

Expand Down Expand Up @@ -420,4 +419,4 @@ after method send

这篇文章中主要介绍了代理模式的两种实现:静态代理以及动态代理。涵盖了静态代理和动态代理实战、静态代理和动态代理的区别、JDK 动态代理和 Cglib 动态代理区别等内容。

文中涉及到的所有源码,你可以在这里找到:[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)
文中涉及到的所有源码,你可以在这里找到:[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)

0 comments on commit 218d095

Please sign in to comment.