package jp.co.fujielectric.maintenanceservice.configs; import com.amazonaws.xray.spring.aop.AbstractXRayInterceptor; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.aspectj.lang.ProceedingJoinPoint; import com.amazonaws.xray.entities.Subsegment; import java.util.Map; @Aspect //(A) @Configuration @ConditionalOnProperty( prefix = "xray", name = "enable", havingValue = "true", matchIfMissing = false ) @EnableAspectJAutoProxy //(B) public class XrayConfiguration extends AbstractXRayInterceptor { //(C) @Override protected Map> generateMetadata(ProceedingJoinPoint proceedingJoinPoint, Subsegment subsegment) { return super.generateMetadata(proceedingJoinPoint, subsegment); } @Override @Pointcut("@within(com.amazonaws.xray.spring.aop.XRayEnabled) && bean(*)") protected void xrayEnabledClasses() { } }