提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.framework.quartz.config; |
H |
2 |
|
|
3 |
import lombok.Data; |
|
4 |
import org.springframework.boot.context.properties.ConfigurationProperties; |
|
5 |
import org.springframework.validation.annotation.Validated; |
|
6 |
|
|
7 |
import javax.validation.Valid; |
|
8 |
import javax.validation.constraints.NotEmpty; |
|
9 |
import javax.validation.constraints.NotNull; |
|
10 |
|
|
11 |
/** |
|
12 |
* XXL-Job 配置类 |
|
13 |
*/ |
|
14 |
@ConfigurationProperties("xxl.job") |
|
15 |
@Validated |
|
16 |
@Data |
|
17 |
public class XxlJobProperties { |
|
18 |
|
|
19 |
/** |
|
20 |
* 是否开启,默认为 true 关闭 |
|
21 |
*/ |
|
22 |
private Boolean enabled = true; |
|
23 |
/** |
|
24 |
* 访问令牌 |
|
25 |
*/ |
|
26 |
private String accessToken; |
|
27 |
/** |
|
28 |
* 控制器配置 |
|
29 |
*/ |
|
30 |
@NotNull(message = "控制器配置不能为空") |
|
31 |
private AdminProperties admin; |
|
32 |
/** |
|
33 |
* 执行器配置 |
|
34 |
*/ |
|
35 |
@NotNull(message = "执行器配置不能为空") |
|
36 |
private ExecutorProperties executor; |
|
37 |
|
|
38 |
/** |
|
39 |
* XXL-Job 调度器配置类 |
|
40 |
*/ |
|
41 |
@Data |
|
42 |
@Valid |
|
43 |
public static class AdminProperties { |
|
44 |
|
|
45 |
/** |
|
46 |
* 调度器地址 |
|
47 |
*/ |
|
48 |
@NotEmpty(message = "调度器地址不能为空") |
|
49 |
private String addresses; |
|
50 |
|
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* XXL-Job 执行器配置类 |
|
55 |
*/ |
|
56 |
@Data |
|
57 |
@Valid |
|
58 |
public static class ExecutorProperties { |
|
59 |
|
|
60 |
/** |
|
61 |
* 默认端口 |
|
62 |
* |
|
63 |
* 这里使用 -1 表示随机 |
|
64 |
*/ |
|
65 |
private static final Integer PORT_DEFAULT = -1; |
|
66 |
|
|
67 |
/** |
|
68 |
* 默认日志保留天数 |
|
69 |
* |
|
70 |
* 如果想永久保留,则设置为 -1 |
|
71 |
*/ |
|
72 |
private static final Integer LOG_RETENTION_DAYS_DEFAULT = 30; |
|
73 |
|
|
74 |
/** |
|
75 |
* 应用名 |
|
76 |
*/ |
|
77 |
@NotEmpty(message = "应用名不能为空") |
|
78 |
private String appName; |
|
79 |
/** |
|
80 |
* 执行器的 IP |
|
81 |
*/ |
|
82 |
private String ip; |
|
83 |
/** |
|
84 |
* 执行器的 Port |
|
85 |
*/ |
|
86 |
private Integer port = PORT_DEFAULT; |
|
87 |
/** |
|
88 |
* 日志地址 |
|
89 |
*/ |
|
90 |
@NotEmpty(message = "日志地址不能为空") |
|
91 |
private String logPath; |
|
92 |
/** |
|
93 |
* 日志保留天数 |
|
94 |
*/ |
|
95 |
private Integer logRetentionDays = LOG_RETENTION_DAYS_DEFAULT; |
|
96 |
|
|
97 |
} |
|
98 |
|
|
99 |
} |