java 读取配置文件信息
public class StaticConstant{
static {
Properties properties = new Properties();
InputStream in = null;
try {
String url = StaticConstant.class.getResource("/jdbc.properties").getPath();
in = new FileInputStream(new File(url));
properties.load(in);
String userName= properties.getProperty("username");
String pwd= properties.getProperty("pwd");
}
}
还没有评论,来说两句吧...