/**字典配置文件*/
public static Dictionaries DICTIONARIES = null;
//设置新的配置文件地址
private static String PATH = "dictionary.xml";
public static void init() throws IOException {
Resource resource = new ClassPathResource(PATH);
String xmlStr = ProFileUtil.get(resource.getInputStream());
JAXBContext context;
try {
context = JAXBContext.newInstance(Dictionaries.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
DICTIONARIES = (Dictionaries) unmarshaller.unmarshal(new StringReader(xmlStr));
} catch (JAXBException e) {
e.printStackTrace();
}
}
通过流的方式获取地址linux中不会报错
linux中file获取项目文件失败,需要用流的方式获取
最新推荐文章于 2022-04-12 13:23:44 发布