方案1:
1.1)准备切面,实现权限认证、日志
@Aspect
@Component
public class LogAspect {
Logger logger = LoggerFactory.getLogger(LogAspect.class);
@Value("${spring.application.name}")
private String serverName;
@Pointcut("@annotation(com.xxx.annotation.LogAnnotation)")
public void beforePointCut () {}
@Before("beforePointCut()")
public void before (JoinPoint joinPoint) {
if (joinPoint == null) {
return;
}
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
String className = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();
Object[] methodAr