From eba79f729000e47af10dde0c1dfb207f5efd05bc Mon Sep 17 00:00:00 2001 From: Junghwan Park Date: Sat, 7 Sep 2019 22:45:27 +0900 Subject: [PATCH] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EC=83=9D=EC=84=B1=EC=97=90=20=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EA=B8=B0=EB=B3=B8=20=EC=82=AC=EC=A0=84=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20related=20#14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../komoran/admin/config/SetupDefaultData.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/kr/co/shineware/nlp/komoran/admin/config/SetupDefaultData.java b/src/main/java/kr/co/shineware/nlp/komoran/admin/config/SetupDefaultData.java index 897dbe9a..dbc86066 100644 --- a/src/main/java/kr/co/shineware/nlp/komoran/admin/config/SetupDefaultData.java +++ b/src/main/java/kr/co/shineware/nlp/komoran/admin/config/SetupDefaultData.java @@ -1,7 +1,9 @@ package kr.co.shineware.nlp.komoran.admin.config; import kr.co.shineware.nlp.komoran.admin.repository.DicWordRepository; +import kr.co.shineware.nlp.komoran.admin.repository.GrammarInRepository; import kr.co.shineware.nlp.komoran.admin.service.DicWordService; +import kr.co.shineware.nlp.komoran.admin.service.GrammarInService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -40,6 +42,12 @@ public class SetupDefaultData implements ApplicationRunner { @Autowired private DicWordService dicWordService; + @Autowired + private GrammarInRepository grammarInRepository; + + @Autowired + private GrammarInService grammarInService; + private Path getDefaultFilePath(String type) { String filePathStr; @@ -71,14 +79,22 @@ private Path getDefaultFilePath(String type) { return pathForDefaultFile; } + @Override public void run(ApplicationArguments args) throws Exception { logger.debug("DicWord : " + dicWordRepository.count()); + logger.debug("GrammarIn : " + grammarInRepository.count()); + // Initialize DicWord if (dicWordRepository.count() <= 0 && getDefaultFilePath("dicword") != null) { logger.debug("Importing DicWord from file named "+ filenameDicWord); dicWordService.importFromFile(getDefaultFilePath("dicword")); } + // Initialize GrammarIn + if (grammarInRepository.count() <= 0 && getDefaultFilePath("grammarrin") != null) { + logger.debug("Importing GrammarIn from file named "+ filenameGrammarIn); + grammarInService.importFromFile(getDefaultFilePath("grammarin")); + } } }