diff --git a/src/main/java/cn/iocoder/dashboard/framework/tracer/annotation/BizTracingAop.java b/src/main/java/cn/iocoder/dashboard/framework/tracer/annotation/BizTracingAop.java index 3b5bb5fa0..3cd1c35fb 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/tracer/annotation/BizTracingAop.java +++ b/src/main/java/cn/iocoder/dashboard/framework/tracer/annotation/BizTracingAop.java @@ -16,7 +16,6 @@ import org.springframework.context.annotation.Configuration; */ @Aspect @Slf4j -@Configuration public class BizTracingAop { @Around(value = "@annotation(bizTracing)") diff --git a/src/main/java/cn/iocoder/dashboard/framework/tracer/config/BizTracerAutoConfiguration.java b/src/main/java/cn/iocoder/dashboard/framework/tracer/config/BizTracerAutoConfiguration.java new file mode 100644 index 000000000..3b63b9c1a --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/framework/tracer/config/BizTracerAutoConfiguration.java @@ -0,0 +1,29 @@ +package cn.iocoder.dashboard.framework.tracer.config; + +import cn.iocoder.dashboard.framework.tracer.annotation.BizTracingAop; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConditionalOnClass({BizTracingAop.class}) +@EnableConfigurationProperties(BizTracerProperties.class) +@ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true) +public class BizTracerAutoConfiguration { + + + @Bean + @ConditionalOnMissingBean + public BizTracerProperties bizTracerProperties() { + return new BizTracerProperties(); + } + + @Bean + public BizTracingAop enableBizTracingAop() { + return new BizTracingAop(); + } + +} diff --git a/src/main/java/cn/iocoder/dashboard/framework/tracer/config/BizTracerProperties.java b/src/main/java/cn/iocoder/dashboard/framework/tracer/config/BizTracerProperties.java new file mode 100644 index 000000000..b831464e6 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/framework/tracer/config/BizTracerProperties.java @@ -0,0 +1,9 @@ +package cn.iocoder.dashboard.framework.tracer.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties("yudao.tracer") +@Data +public class BizTracerProperties { +}