fix: [xxljob开关]

This commit is contained in:
ovo 2025-03-30 21:11:52 +08:00
parent 6b3a6217b8
commit 1917337775
2 changed files with 6 additions and 0 deletions

View File

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

View File

@ -211,6 +211,7 @@ logging:
xxl:
job:
enabled: false # 控制是否启用xxl-job
admin:
addresses: http://192.168.0.122:9001/xxl-job-admin
accessToken: GuwanTest