格式修改
This commit is contained in:
+1
-1
@@ -19,5 +19,5 @@ public class BaiyueAuditAutoConfiguration {
|
||||
return p.getEndpoint() == null || p.getEndpoint().isBlank() ? new LoggingAuditSink() : new HttpAuditSink(builder, p.getEndpoint());
|
||||
}
|
||||
@Bean SensitiveDataSanitizer sensitiveDataSanitizer(ObjectMapper mapper, AuditProperties p) { return new SensitiveDataSanitizer(mapper, p.getMaxPayloadLength()); }
|
||||
@Bean BusinessAuditAspect businessAuditAspect(AuditSink sink, SensitiveDataSanitizer sanitizer, AuditProperties p) { return new BusinessAuditAspect(sink, sanitizer, p.getServiceName()); }
|
||||
@Bean BusinessAuditAspect businessAuditAspect() { return new BusinessAuditAspect(); }
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.baiyue.common.audit;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import com.baiyue.common.security.AuthenticatedUser;
|
||||
import com.baiyue.common.web.CorrelationContext;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@@ -27,15 +30,14 @@ import java.util.Arrays;
|
||||
@Aspect
|
||||
public class BusinessAuditAspect {
|
||||
private static final Logger log = LoggerFactory.getLogger(BusinessAuditAspect.class);
|
||||
private final AuditSink sink;
|
||||
private final SensitiveDataSanitizer sanitizer;
|
||||
private final String serviceName;
|
||||
@Resource
|
||||
private AuditSink sink;
|
||||
@Resource
|
||||
private SensitiveDataSanitizer sanitizer;
|
||||
@Value("${baiyue.audit.service-name:unknown-service}")
|
||||
private String serviceName;
|
||||
private final ExpressionParser parser = new SpelExpressionParser();
|
||||
|
||||
public BusinessAuditAspect(AuditSink sink, SensitiveDataSanitizer sanitizer, String serviceName) {
|
||||
this.sink = sink; this.sanitizer = sanitizer; this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
@Around("@annotation(audit)")
|
||||
public Object around(ProceedingJoinPoint pjp, BusinessAudit audit) throws Throwable {
|
||||
long start = System.nanoTime();
|
||||
|
||||
Reference in New Issue
Block a user