java解析properties文件

 
 
Properties properties = new Properties();
           InputStream in =PropertyUtils. class .getClassLoader().getResourceAsStream( "service.properties" );
properties.load(in);
 
       Class.forName( "org.postgresql.Driver" );
        String url=properties.getProperty( "jdbc.url" );
        conn = DriverManager.getConnection(url,properties.getProperty( "jdbc.username" ),properties.getProperty( "jdbc.password" ));

你可能感兴趣的:(java解析properties文件)