diff --git a/ruoyi-common/ruoyi-common-job/src/main/java/org/dromara/common/job/config/PowerJobConfig.java b/ruoyi-common/ruoyi-common-job/src/main/java/org/dromara/common/job/config/PowerJobConfig.java index 75f9412c..35612f3b 100644 --- a/ruoyi-common/ruoyi-common-job/src/main/java/org/dromara/common/job/config/PowerJobConfig.java +++ b/ruoyi-common/ruoyi-common-job/src/main/java/org/dromara/common/job/config/PowerJobConfig.java @@ -1,8 +1,8 @@ package org.dromara.common.job.config; import cn.hutool.core.collection.CollUtil; -import org.apache.commons.lang3.StringUtils; import org.dromara.common.core.utils.StreamUtils; +import org.dromara.common.core.utils.StringUtils; import org.dromara.common.job.config.properties.PowerJobProperties; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -10,7 +10,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.context.annotation.Bean; -import org.springframework.scheduling.annotation.EnableScheduling; import tech.powerjob.common.utils.CommonUtils; import tech.powerjob.common.utils.NetUtils; import tech.powerjob.worker.PowerJobSpringWorker; @@ -20,16 +19,15 @@ import java.util.Arrays; import java.util.List; /** - * 启动定时任务 + * Autoconfiguration class for PowerJob-worker. * - * @author yhan219 - * @since 2023/6/2 + * @author songyinyin + * @since 2020/7/26 16:37 */ @AutoConfiguration -@ConditionalOnProperty(prefix = "powerjob.worker", name = "enabled", havingValue = "true") @EnableConfigurationProperties(PowerJobProperties.class) -@EnableScheduling -public class PowerJobConfig { +@ConditionalOnProperty(prefix = "powerjob.worker", name = "enabled", havingValue = "true", matchIfMissing = true) +public class PowerJobConfig{ @Bean public PowerJobSpringWorker initPowerJob(PowerJobProperties properties, DiscoveryClient discoveryClient) { @@ -87,7 +85,7 @@ public class PowerJobConfig { * When enabledTestMode is set as true, PowerJob-worker no longer connects to PowerJob-server * or validate appName. */ - config.setEnableTestMode(worker.isEnableTestMode()); + config.setAllowLazyConnectServer(worker.isAllowLazyConnectServer()); /* * Max length of appended workflow context . Appended workflow context value that is longer than the value will be ignored. */ diff --git a/ruoyi-common/ruoyi-common-job/src/main/java/org/dromara/common/job/config/properties/PowerJobProperties.java b/ruoyi-common/ruoyi-common-job/src/main/java/org/dromara/common/job/config/properties/PowerJobProperties.java index 4b7bd7a3..df5f2853 100644 --- a/ruoyi-common/ruoyi-common-job/src/main/java/org/dromara/common/job/config/properties/PowerJobProperties.java +++ b/ruoyi-common/ruoyi-common-job/src/main/java/org/dromara/common/job/config/properties/PowerJobProperties.java @@ -81,10 +81,10 @@ public class PowerJobProperties { */ private int maxResultLength = 8192; /** - * If test mode is set as true, Powerjob-worker no longer connects to the server or validates appName. - * Test mode is used for conditions that your have no powerjob-server in your develop env, so you can't start up the application + * If allowLazyConnectServer is set as true, PowerJob worker allows launching without a direct connection to the server. + * allowLazyConnectServer is used for conditions that your have no powerjob-server in your develop env so you can't startup the application */ - private boolean enableTestMode = false; + private boolean allowLazyConnectServer = false; /** * Max length of appended workflow context value length. Appended workflow context value that is longer than the value will be ignored. * {@link WorkflowContext} max length for #appendedContextData