fix: [xxljob开关]
This commit is contained in:
parent
6b3a6217b8
commit
1917337775
|
@ -2,10 +2,14 @@ package com.guwan.backend.config;
|
||||||
|
|
||||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
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.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@ConditionalOnProperty(prefix = "xxl.job", name = "enabled", havingValue = "true")
|
||||||
public class XxlJobConfig {
|
public class XxlJobConfig {
|
||||||
@Value("${xxl.job.admin.addresses}")
|
@Value("${xxl.job.admin.addresses}")
|
||||||
private String adminAddresses;
|
private String adminAddresses;
|
||||||
|
@ -26,6 +30,7 @@ public class XxlJobConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||||
|
log.info(">>>>>>>>>>> xxl-job config init.");
|
||||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||||
xxlJobSpringExecutor.setAppname(appname);
|
xxlJobSpringExecutor.setAppname(appname);
|
||||||
|
|
|
@ -211,6 +211,7 @@ logging:
|
||||||
|
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
|
enabled: false # 控制是否启用xxl-job
|
||||||
admin:
|
admin:
|
||||||
addresses: http://192.168.0.122:9001/xxl-job-admin
|
addresses: http://192.168.0.122:9001/xxl-job-admin
|
||||||
accessToken: GuwanTest
|
accessToken: GuwanTest
|
||||||
|
|
Loading…
Reference in New Issue