diff --git a/src/main/java/com/guwan/backend/config/XxlJobConfig.java b/src/main/java/com/guwan/backend/config/XxlJobConfig.java index 775722c..a02c3a6 100644 --- a/src/main/java/com/guwan/backend/config/XxlJobConfig.java +++ b/src/main/java/com/guwan/backend/config/XxlJobConfig.java @@ -2,10 +2,14 @@ package com.guwan.backend.config; import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import lombok.extern.slf4j.Slf4j; +@Slf4j @Configuration +@ConditionalOnProperty(prefix = "xxl.job", name = "enabled", havingValue = "true") public class XxlJobConfig { @Value("${xxl.job.admin.addresses}") private String adminAddresses; @@ -26,6 +30,7 @@ public class XxlJobConfig { @Bean public XxlJobSpringExecutor xxlJobExecutor() { + log.info(">>>>>>>>>>> xxl-job config init."); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); xxlJobSpringExecutor.setAdminAddresses(adminAddresses); xxlJobSpringExecutor.setAppname(appname); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 777e6c6..32d5b36 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -211,6 +211,7 @@ logging: xxl: job: + enabled: false # 控制是否启用xxl-job admin: addresses: http://192.168.0.122:9001/xxl-job-admin accessToken: GuwanTest