敏感词加载继续优化一下,初始化放在consumer中执行

This commit is contained in:
Chopper
2021-11-29 11:47:54 +08:00
parent d16df738d3
commit 61aa3ca3d2
2 changed files with 43 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
/**
* 初始化敏感词
* 敏感词加载
*
* @author Chopper
* @version v1.0
@@ -20,13 +20,15 @@ import java.util.List;
*/
@Component
@Slf4j
public class SensitiveInit implements ApplicationRunner {
public class SensitiveWordsLoader implements ApplicationRunner {
@Autowired
private Cache<List<String>> cache;
/**
* 程序启动时获取最新的需要过滤的敏感词
* <p>
* 这里即便缓存中为空也没关系定时任务会定时重新加载敏感词
*
* @param args 启动参数
*/