package com.vci.web.properties;
|
|
import com.alibaba.fastjson.JSON;
|
import com.vci.pagemodel.MenuVO;
|
import org.apache.commons.io.FileUtils;
|
import org.springframework.util.ResourceUtils;
|
|
import java.io.*;
|
|
/**
|
* 读取json配置文件,菜单等
|
* @author ludc
|
* @date 2024/8/16 10:09
|
*/
|
public class JsonConfigReader {
|
|
/**
|
* 菜单json配置文件,如有其他需要读取的,可以仿照当前逻辑编写
|
*/
|
private static MenuVO menuVO;
|
|
static{
|
try {
|
File file = ResourceUtils.getFile("classpath:menuConfig.json");
|
String json = FileUtils.readFileToString(file, "UTF-8");
|
menuVO = JSON.parseObject(json, MenuVO.class);
|
}catch (IOException e) {
|
e.printStackTrace();
|
}
|
}
|
|
public static MenuVO getMenuVO() {
|
return menuVO;
|
}
|
|
}
|