`

读取properties文件内容

    博客分类:
  • java
 
阅读更多
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ReadProperties {

	public static void main(String[] args) throws IOException {

		Properties prop = new Properties();

		InputStream input = ReadProperties.class
				.getResourceAsStream("jdbc.properties");
		
		prop.load(input);

		System.out.println(prop.getProperty("jdbc.driver"));
	}
}

jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc\:sqlserver\://localhost\:1433;database\=demodb
jdbc.username=admin
jdbc.password=admin
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics