提交 | 用户 | 时间
|
722af2
|
1 |
package com.dl.system.runner; |
X |
2 |
|
|
3 |
import com.dl.common.config.DLConfig; |
|
4 |
import com.dl.system.service.ISysConfigService; |
|
5 |
import com.dl.system.service.ISysDictTypeService; |
|
6 |
import com.dl.system.service.ISysOssConfigService; |
|
7 |
import lombok.RequiredArgsConstructor; |
|
8 |
import lombok.extern.slf4j.Slf4j; |
|
9 |
import org.springframework.boot.ApplicationArguments; |
|
10 |
import org.springframework.boot.ApplicationRunner; |
|
11 |
import org.springframework.stereotype.Component; |
|
12 |
|
|
13 |
/** |
|
14 |
* 初始化 system 模块对应业务数据 |
|
15 |
* |
|
16 |
* @author Lion Li |
|
17 |
*/ |
|
18 |
@Slf4j |
|
19 |
@RequiredArgsConstructor |
|
20 |
@Component |
|
21 |
public class SystemApplicationRunner implements ApplicationRunner { |
|
22 |
|
|
23 |
private final DLConfig dlConfig; |
|
24 |
private final ISysConfigService configService; |
|
25 |
private final ISysDictTypeService dictTypeService; |
|
26 |
private final ISysOssConfigService ossConfigService; |
|
27 |
|
|
28 |
@Override |
|
29 |
public void run(ApplicationArguments args) throws Exception { |
|
30 |
ossConfigService.init(); |
|
31 |
log.info("初始化OSS配置成功"); |
|
32 |
if (dlConfig.isCacheLazy()) { |
|
33 |
return; |
|
34 |
} |
|
35 |
configService.loadingConfigCache(); |
|
36 |
log.info("加载参数缓存数据成功"); |
|
37 |
dictTypeService.loadingDictCache(); |
|
38 |
log.info("加载字典缓存数据成功"); |
|
39 |
} |
|
40 |
|
|
41 |
} |