读取相关的配置

String fileName = "shiro_base_auth.ini";
ClassPathResource cp = new ClassPathResource(fileName);redis

ini = new INI4j(cp.getFile());spa

 

------------------------------------------------------------------------get

// 读取相关的配置  配置文件必须放在src下it

ResourceBundle resourceBundle = ResourceBundle.getBundle("redis");
int maxActive = Integer.parseInt(resourceBundle.getString("redis.pool.maxActive"));
int maxIdle = Integer.parseInt(resourceBundle.getString("redis.pool.maxIdle"));
int maxWait = Integer.parseInt(resourceBundle.getString("redis.pool.maxWait"));io

 

-------------------------------------------------------------------------ast

public final static String DIR = PathConstants.class.getClassLoader().getResource("conf").getPath();
public final static String baseConfig = DIR + File.separator + "jflow-path.properties";class

 

-------------------------------------------------------------------------------cli

private static final Resource CONF_FILENAME = new ClassPathResource("fdfs_client.properties");;配置

/** fdfs 访问的根Url **/
private static String fastDFSUrl = "";

public static String getFastDFSUrl(){
try {
IniFileReader iniReader = new IniFileReader(CONF_FILENAME.getFile().getAbsolutePath());
fastDFSUrl = iniReader.getStrValue("fastDFSUrl");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return fastDFSUrl;
}file