Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
java-training
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengbin
java-training
Commits
1ae0a4d4
Commit
1ae0a4d4
authored
Nov 08, 2018
by
pengbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aop
parent
1ccd91e8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
mydemo/src/main/java/com/saraad/common/aop/ServiceLog.java
+13
-0
No files found.
mydemo/src/main/java/com/saraad/common/aop/ServiceLog.java
View file @
1ae0a4d4
...
...
@@ -2,6 +2,7 @@ package com.saraad.common.aop;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.Signature
;
import
org.aspectj.lang.annotation.After
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
...
...
@@ -41,4 +42,16 @@ public class ServiceLog {
System
.
out
.
println
(
"正在执行:"
+
target
.
getClass
().
getName
()+
"_"
+
method
.
getName
());
}
@After
(
"log()"
)
public
void
doAfter
(
JoinPoint
joinPoint
){
Object
target
=
joinPoint
.
getTarget
();
Signature
signature
=
joinPoint
.
getSignature
();
if
(!(
signature
instanceof
MethodSignature
))
throw
new
IllegalArgumentException
(
"非实现类方法"
);
MethodSignature
ms
=
(
MethodSignature
)
signature
;
Method
method
=
ms
.
getMethod
();
System
.
out
.
println
(
target
.
getClass
().
getName
()+
"_"
+
method
.
getName
()+
"执行完毕"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment