|
@@ -0,0 +1,29 @@
|
|
|
|
+package com.diagbot.config;
|
|
|
|
+
|
|
|
|
+import com.diagbot.facade.CacheFacade;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.boot.CommandLineRunner;
|
|
|
|
+import org.springframework.core.annotation.Order;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @description: 项目启动后初始化缓存
|
|
|
|
+ * @author: zhoutg
|
|
|
|
+ * @time: 2020/4/3 14:31
|
|
|
|
+ */
|
|
|
|
+@Component //把类交给spring容器管理
|
|
|
|
+@Order(100) //使用order属性,设置该类在spring容器中的加载顺序
|
|
|
|
+@Slf4j
|
|
|
|
+public class CacheDeleteInit implements CommandLineRunner {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ CacheFacade cacheFacade;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void run(String... args) throws Exception {
|
|
|
|
+ // 服务启动清除redis缓存
|
|
|
|
+ log.info("ICSS嵌入模式缓存启动初始化成功!");
|
|
|
|
+ cacheFacade.clear();
|
|
|
|
+ }
|
|
|
|
+}
|