liusheng
5 天以前 cc479e6a056785103996cc7ea67dbd5faa3e800e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.ruoyi.task.config;
 
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
/**
 * 任务模块配置(前缀 {@code task})。
 * <p>
 * ⚠️ <b>这不是主开关</b>。任务模块的开关<b>存在 {@code sys_config} 参数配置表里</b>:
 * <pre>
 * 参数键名:task.enabled
 * 参数键值:true(启用,默认)/ false(关闭)
 * </pre>
 * 见 {@link TaskSwitch}。本类的 {@link #isEnabled()} 只作为<b>兜底</b>:
 * 当 {@code sys_config} 里没有这一行、或非 Spring 环境取不到配置服务时才会用到。
 * <p>
 * 如需在 yml 中兜底(一般不必要,正常应在参数设置页维护):
 * <pre>
 * task:
 *   enabled: false
 * </pre>
 */
@Data
@Component
@ConfigurationProperties(prefix = "task")
public class TaskProperties {
 
    /**
     * 是否启用任务模块(默认启用)。
     * <p>
     * 仅当 {@code sys_config} 中没有 {@code task.enabled} 时生效,见 {@link TaskSwitch}。
     */
    private boolean enabled = true;
}