mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-29 04:51:58 +08:00
xxl-job 修复
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
package com.ruoyi.system;
|
package com.ruoyi.system;
|
||||||
import com.github.pagehelper.PageInterceptor;
|
import com.github.pagehelper.PageInterceptor;
|
||||||
|
import com.ruoyi.system.configProperties.XxlJobProperties;
|
||||||
|
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import lombok.var;
|
import lombok.var;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||||
@@ -15,6 +19,7 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@Log4j2
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@@ -50,4 +55,19 @@ public class RuoYiSystemApplication
|
|||||||
//i.setProperties(null);
|
//i.setProperties(null);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@Autowired
|
||||||
|
private XxlJobProperties xxlJobProperties;
|
||||||
|
@Bean
|
||||||
|
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||||
|
System.out.println(">>>>>>>>>>> xxl-job config init from nacos");
|
||||||
|
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||||
|
xxlJobSpringExecutor.setAdminAddresses(xxlJobProperties.getAdmin().getAddresses());
|
||||||
|
xxlJobSpringExecutor.setAppname(xxlJobProperties.getExecutor().getAppname());
|
||||||
|
xxlJobSpringExecutor.setIp(xxlJobProperties.getExecutor().getIp());
|
||||||
|
xxlJobSpringExecutor.setPort(xxlJobProperties.getExecutor().getPort());
|
||||||
|
xxlJobSpringExecutor.setAccessToken(xxlJobProperties.getAccessToken());
|
||||||
|
xxlJobSpringExecutor.setLogPath(xxlJobProperties.getExecutor().getLogpath());
|
||||||
|
xxlJobSpringExecutor.setLogRetentionDays(xxlJobProperties.getExecutor().getLogretentiondays());
|
||||||
|
return xxlJobSpringExecutor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.ruoyi.system.configProperties;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties("xxl.job")
|
||||||
|
@RefreshScope
|
||||||
|
public class XxlJobProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* admin : {"addresses":"http://192.168.2.165:32530/xxl-job-admin"}
|
||||||
|
* executor : {"ip":null,"port":9999,"logpath":"/data/applogs/xxl-job/jobhandler","appname":"xxl-job-001"}
|
||||||
|
* accessToken : null
|
||||||
|
*/
|
||||||
|
|
||||||
|
private AdminBean admin;
|
||||||
|
private ExecutorBean executor;
|
||||||
|
private String accessToken;
|
||||||
|
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public static class AdminBean {
|
||||||
|
/**
|
||||||
|
* addresses : http://192.168.2.165:32530/xxl-job-admin
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String addresses;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public static class ExecutorBean {
|
||||||
|
/**
|
||||||
|
* ip : null
|
||||||
|
* port : 9999
|
||||||
|
* logpath : /data/applogs/xxl-job/jobhandler
|
||||||
|
* appname : xxl-job-001
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
private int port;
|
||||||
|
private String logpath;
|
||||||
|
private String appname;
|
||||||
|
private int logretentiondays;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user