feat: xxz-job 调度中心首次提交
内容: 1. 核心包开发,注解开发 2. 任务扫描以及本地注册 3. 任务执行,任务支持本地单机调用 4. 样本执行器生成
This commit is contained in:
21
xservice-quartz-sample/src/main/java/com/xiang/app/Main.java
Normal file
21
xservice-quartz-sample/src/main/java/com/xiang/app/Main.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.xiang.app;
|
||||
|
||||
import com.xiang.core.quartz.annotation.EnableXxzJob;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-01-06 09:52
|
||||
*/
|
||||
@EnableXxzJob(basePackages = {"com.xiang.app.quartz.sample.springboot.schedule.TestXxzJob1"})
|
||||
@SpringBootApplication
|
||||
@ComponentScan(basePackages = {
|
||||
"com.xiang.*"
|
||||
})
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Main.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xiang.app.quartz.sample.springboot.schedule;
|
||||
|
||||
import com.xiang.core.quartz.annotation.XxzJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: xiang
|
||||
* @Date: 2026-01-06 09:57
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class TestXxzJob1 {
|
||||
|
||||
@XxzJob(name = "TestXxzJob", cron = "0/1 * * * * ? ", enabled = true)
|
||||
public void test() {
|
||||
log.info("任务调度开始");
|
||||
}
|
||||
}
|
||||
39
xservice-quartz-sample/src/main/resources/application.yml
Normal file
39
xservice-quartz-sample/src/main/resources/application.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
xxz-job:
|
||||
app-name: springboot-quartz-test
|
||||
|
||||
spring:
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
name: springboot-quartz-test
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
group: DEFAULT_GROUP
|
||||
namespace: 00131110-3ecb-4a35-8bbb-624edde1d937
|
||||
server-addr: general.xiangtech.xyz:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
datasource:
|
||||
dynamic:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://120.27.153.87:3306/xservice_quartz?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
username: quartz
|
||||
password: quartz@123
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
sshConnect: false
|
||||
|
||||
redis:
|
||||
host: r-bp1wt59a6nfyt4e3ltpd.redis.rds.aliyuncs.com
|
||||
port: 6379
|
||||
password: Xiang0000 # 如果无密码可以省略
|
||||
database: 10
|
||||
timeout: 5000
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
max-wait: 1000
|
||||
Reference in New Issue
Block a user