From 1917337775d002e659f25a7ea1e7f164a444b3ce Mon Sep 17 00:00:00 2001 From: ovo Date: Sun, 30 Mar 2025 21:11:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20[xxljob=E5=BC=80=E5=85=B3]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/guwan/backend/config/XxlJobConfig.java | 5 +++++ src/main/resources/application.yml | 1 + 2 files changed, 6 insertions(+) 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