|
@@ -1,6 +1,7 @@
|
|
|
package cn.reghao.dfs.store.config.spring;
|
|
package cn.reghao.dfs.store.config.spring;
|
|
|
|
|
|
|
|
import cn.reghao.dfs.store.config.OssProperties;
|
|
import cn.reghao.dfs.store.config.OssProperties;
|
|
|
|
|
+import cn.reghao.dfs.store.task.FileTask;
|
|
|
import cn.reghao.dfs.store.util.store.LocalStores;
|
|
import cn.reghao.dfs.store.util.store.LocalStores;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.DisposableBean;
|
|
import org.springframework.beans.factory.DisposableBean;
|
|
@@ -16,9 +17,11 @@ import org.springframework.stereotype.Component;
|
|
|
@Component
|
|
@Component
|
|
|
public class FileLifecycle implements ApplicationRunner, DisposableBean {
|
|
public class FileLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
private final OssProperties ossProperties;
|
|
private final OssProperties ossProperties;
|
|
|
|
|
+ private final FileTask fileTask;
|
|
|
|
|
|
|
|
- public FileLifecycle(OssProperties ossProperties) {
|
|
|
|
|
|
|
+ public FileLifecycle(OssProperties ossProperties, FileTask fileTask) {
|
|
|
this.ossProperties = ossProperties;
|
|
this.ossProperties = ossProperties;
|
|
|
|
|
+ this.fileTask = fileTask;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -26,6 +29,10 @@ public class FileLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
log.info("加载本地磁盘数据...");
|
|
log.info("加载本地磁盘数据...");
|
|
|
LocalStores.init(ossProperties);
|
|
LocalStores.init(ossProperties);
|
|
|
log.info("本地磁盘数据加载完成...");
|
|
log.info("本地磁盘数据加载完成...");
|
|
|
|
|
+
|
|
|
|
|
+ log.info("执行文件任务...");
|
|
|
|
|
+ fileTask.exec();
|
|
|
|
|
+ log.info("文件任务执行完成...");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|