|
@@ -3,6 +3,7 @@ package com.yonge.cooleshow.biz.dal.wordfilter;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysConfigService;
|
|
|
import com.yonge.cooleshow.common.constant.SysConfigConstant;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -11,6 +12,8 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.io.BufferedReader;
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
import java.io.InputStreamReader;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -21,7 +24,6 @@ import java.util.*;
|
|
|
*
|
|
|
* @author minghu.zhang
|
|
|
*/
|
|
|
-@SuppressWarnings({"rawtypes", "unchecked"})
|
|
|
@Configuration
|
|
|
public class WordContext {
|
|
|
private final static Logger log = LoggerFactory.getLogger(WordContext.class);
|
|
@@ -49,8 +51,13 @@ public class WordContext {
|
|
|
|
|
|
@PostConstruct
|
|
|
public void init() {
|
|
|
- this.blackList = sysConfigService.findConfigValue(SysConfigConstant.BLACK_LIST);
|
|
|
- this.whiteList = sysConfigService.findConfigValue(SysConfigConstant.WHITE_LIST);
|
|
|
+ try {
|
|
|
+ this.blackList = FileUtils.readFileToString(new File("/Users/chenxiaoyu/Documents/blacklist.txt"), "UTF-8");
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+// this.blackList = sysConfigService.findConfigValue(SysConfigConstant.BLACK_LIST);
|
|
|
+// this.whiteList = sysConfigService.findConfigValue(SysConfigConstant.WHITE_LIST);
|
|
|
initKeyWord();
|
|
|
}
|
|
|
|