refactor: 切面日志异常请求拦截处理
This commit is contained in:
parent
c57e63f8c4
commit
f89bb88ac6
|
@ -12,10 +12,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.annotation.AfterReturning;
|
import org.aspectj.lang.annotation.*;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
|
||||||
import org.aspectj.lang.annotation.Before;
|
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.core.StandardReflectionParameterNameDiscoverer;
|
import org.springframework.core.StandardReflectionParameterNameDiscoverer;
|
||||||
|
@ -72,6 +69,13 @@ public class OperationLogAspect {
|
||||||
public void logPointCut() {
|
public void logPointCut() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterThrowing(pointcut = "logPointCut()", throwing = "ex")
|
||||||
|
public void handleException(Exception ex) {
|
||||||
|
localUser.remove();
|
||||||
|
beforeValues.remove();
|
||||||
|
LogUtils.error(ex);
|
||||||
|
}
|
||||||
|
|
||||||
@Before("logPointCut()")
|
@Before("logPointCut()")
|
||||||
public void before(JoinPoint joinPoint) {
|
public void before(JoinPoint joinPoint) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue