Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
王仕雄
/
wangsx-test
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 41d550b2
authored
Jun 09, 2020
by
王仕雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jdk代理与cglib代理打印相同信息
1 parent
9ca0a396
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
khdo/src/main/java/com/bootdo/common/utils/proxy/jdk/JDKDynamicProxy.java
khdo/src/main/java/com/bootdo/common/utils/proxy/jdk/RealSubject.java
khdo/src/main/java/com/bootdo/common/utils/proxy/jdk/JDKDynamicProxy.java
View file @
41d550b
...
...
@@ -23,9 +23,10 @@ public class JDKDynamicProxy implements InvocationHandler {
@Override
public
Object
invoke
(
Object
proxy
,
Method
method
,
Object
[]
args
)
throws
Throwable
{
System
.
out
.
println
(
"Do something before"
);
System
.
out
.
println
(
"开始执行代理类逻辑"
);
System
.
out
.
println
(
"执行完代理类逻辑,准备执行真实对象方法"
);
Object
result
=
method
.
invoke
(
target
,
args
);
System
.
out
.
println
(
"Do something after
"
);
System
.
out
.
println
(
"真实对象方法执行完毕
"
);
return
result
;
}
}
khdo/src/main/java/com/bootdo/common/utils/proxy/jdk/RealSubject.java
View file @
41d550b
...
...
@@ -4,7 +4,7 @@ public class RealSubject implements Subject {
@Override
public
void
doSomething
()
{
System
.
out
.
println
(
"RealSubject do something
"
);
System
.
out
.
println
(
"我打印啦!
"
);
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment