敏感词加载继续优化一下,初始化放在consumer中执行
This commit is contained in:
39
consumer/src/main/java/cn/lili/init/SensitiveWordsInit.java
Normal file
39
consumer/src/main/java/cn/lili/init/SensitiveWordsInit.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package cn.lili.init;
|
||||
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.sensitive.SensitiveWordsFilter;
|
||||
import cn.lili.modules.system.service.SensitiveWordsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SensitiveWordsInit
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2021-11-29 11:38
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SensitiveWordsInit implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private SensitiveWordsService sensitiveWordsService;
|
||||
|
||||
/**
|
||||
* consumer 启动时,实时更新一下过滤词
|
||||
*
|
||||
* @param args 启动参数
|
||||
*/
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
sensitiveWordsService.resetCache();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user