ReadProperties

package com.hgx.test.common;

import java.io.*;
import java.util.Properties;

/**
* config file read
*
* @author sasou <admin@php-gene.com> web:http://www.php-gene.com/
* @version 1.0.0
*/
public class ReadProperties {
static final String propertiesFilename = "SysConfig.properties";
Properties p = new Properties();

public Properties readProperties() {
/* try {
InputStream inputStream = new BufferedInputStream(
new FileInputStream(System.getProperty("user.dir") + "/src/main/resources/" + propertiesFilename));
try {
p.load(inputStream);
} catch (IOException e) {

}
} catch (FileNotFoundException e) {

}*/

try {
InputStream inputStream = ClassLoader.getSystemResourceAsStream(propertiesFilename);
try {
p.load(inputStream);
} catch (IOException e) {

}
} catch (Exception e) {

}
return p;
}
}
posted @ 2018-12-18 09:52  何国秀_xue  阅读(493)  评论(0编辑  收藏  举报