AOP的注入从@Component改为@Configuration

This commit is contained in:
dark 2021-03-21 22:51:08 +08:00
parent 912bea0c53
commit 00bcb50ba9
3 changed files with 38 additions and 1 deletions

View File

@ -16,7 +16,6 @@ import org.springframework.context.annotation.Configuration;
*/ */
@Aspect @Aspect
@Slf4j @Slf4j
@Configuration
public class BizTracingAop { public class BizTracingAop {
@Around(value = "@annotation(bizTracing)") @Around(value = "@annotation(bizTracing)")

View File

@ -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();
}
}

View File

@ -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 {
}