|
@@ -32,6 +32,8 @@ import lombok.NonNull;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
|
+import org.springframework.boot.ApplicationArguments;
|
|
|
+import org.springframework.boot.ApplicationRunner;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
|
/**
|
|
@@ -41,7 +43,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
* @date 2024/5/9
|
|
|
*/
|
|
|
@Slf4j
|
|
|
-public class DefaultExportHandler implements ExportHandler {
|
|
|
+public class DefaultExportHandler implements ExportHandler, ApplicationRunner {
|
|
|
private final String directory;
|
|
|
private final Duration duration;
|
|
|
private final RedisTemplate<String, Object> redisTemplate;
|
|
@@ -122,7 +124,7 @@ public class DefaultExportHandler implements ExportHandler {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void initialize() {
|
|
|
+ public void run(ApplicationArguments args) throws Exception {
|
|
|
// 初始化导出文件清理线程
|
|
|
ThreadUtils.run(() -> {
|
|
|
log.info("Export file cleaner running...");
|