引入spring 包
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
Resource resource = new ClassPathResource("dic/stopword.lex");
BufferedReader br = new BufferedReader(new InputStreamReader(resource.getInputStream()));
String line = null;
while((line = br.readLine()) != null) {
stopWords.add(line);
}
#得到路径
String path = this.getClass().getClassLoader().getResource("pinyin_detect/one_mouth_search_recode.txt").getPath()