//package com.xiaopeng.automaticPilot.config; // //import lombok.extern.slf4j.Slf4j; //import org.aspectj.lang.ProceedingJoinPoint; //import org.aspectj.lang.annotation.Around; //import org.aspectj.lang.annotation.Aspect; //import org.aspectj.lang.reflect.MethodSignature; //import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Profile; // //import java.util.Arrays; // //@Slf4j //@Aspect //@Configuration ////@Profile("local") //public class LocalMockConfig { // //// // ---- mock: getSecretById 远程不可用时返回本地 secret ---- //// //// @Around("execution(* com.xiaopeng.unifiedverification.service.AuthBizServiceForSdk.getSecretById(..))") //// public Object mockGetSecretById(ProceedingJoinPoint pjp) { //// try { //// return pjp.proceed(); //// } catch (Throwable e) { //// log.warn("[LocalMock] getSecretById 远程调用失败,返回本地 mock secret. error: {}", e.getMessage()); //// return "ghepbrwmgcispjja"; //// } //// } // // // ---- feign 调用全量日志 ---- // // @Around( // "within(@org.springframework.cloud.openfeign.FeignClient *)" + // " || within(com.xiaopeng.unifiedverification.remote.feign..*)" // ) // public Object logFeignCall(ProceedingJoinPoint pjp) throws Throwable { // MethodSignature sig = (MethodSignature) pjp.getSignature(); // String clazz = sig.getDeclaringType().getSimpleName(); // String method = sig.getName(); // Object[] args = pjp.getArgs(); // // log.info("[FeignLog] >>> {}.{}() args={}", clazz, method, Arrays.toString(args)); // long start = System.currentTimeMillis(); // try { // Object result = pjp.proceed(); // log.info("[FeignLog] <<< {}.{}() cost={}ms result={}", clazz, method, // System.currentTimeMillis() - start, result); // return result; // } catch (Throwable e) { // log.error("[FeignLog] <<< {}.{}() cost={}ms EXCEPTION: {} - {}", // clazz, method, System.currentTimeMillis() - start, // e.getClass().getName(), e.getMessage()); // throw e; // } // } //}