mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-02-06 10:35:32 +08:00
JeecgBoot 2.4 微服务正式版本发布,基于SpringBoot的低代码平台
This commit is contained in:
21
jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-job/pom.xml
Normal file
21
jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-job/pom.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-starter</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-boot-starter-job</artifactId>
|
||||
<description>jeecg-boot-starter-定时任务</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>${xxl-job-core.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,44 @@
|
||||
package org.jeecg.boot.starter.job.config;
|
||||
|
||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.boot.starter.job.prop.XxlJobProperties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 定时任务配置
|
||||
*
|
||||
* @author jeecg
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(value = XxlJobProperties.class)
|
||||
@ConditionalOnProperty(value = "jeecg.xxljob.enabled", havingValue = "true", matchIfMissing = true)
|
||||
public class XxlJobConfiguration {
|
||||
|
||||
|
||||
@Autowired
|
||||
private XxlJobProperties xxlJobProperties;
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "destroy")
|
||||
@ConditionalOnClass()
|
||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||
log.info(">>>>>>>>>>> xxl-job config init.");
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(xxlJobProperties.getAdminAddresses());
|
||||
xxlJobSpringExecutor.setAppname(xxlJobProperties.getAppname());
|
||||
xxlJobSpringExecutor.setIp(xxlJobProperties.getIp());
|
||||
xxlJobSpringExecutor.setPort(xxlJobProperties.getPort());
|
||||
xxlJobSpringExecutor.setAccessToken(xxlJobProperties.getAccessToken());
|
||||
xxlJobSpringExecutor.setLogPath(xxlJobProperties.getLogPath());
|
||||
xxlJobSpringExecutor.setLogRetentionDays(xxlJobProperties.getLogRetentionDays());
|
||||
return xxlJobSpringExecutor;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package org.jeecg.boot.starter.job.prop;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "jeecg.xxljob")
|
||||
public class XxlJobProperties {
|
||||
|
||||
|
||||
private String adminAddresses;
|
||||
|
||||
|
||||
private String appname;
|
||||
|
||||
|
||||
private String ip;
|
||||
|
||||
|
||||
private int port;
|
||||
|
||||
|
||||
private String accessToken;
|
||||
|
||||
|
||||
private String logPath;
|
||||
|
||||
|
||||
private int logRetentionDays;
|
||||
|
||||
/**
|
||||
* 是否开启xxljob
|
||||
*/
|
||||
private Boolean enable = true;
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
org.jeecg.boot.starter.job.config.XxlJobConfiguration
|
||||
Reference in New Issue
Block a user