zoukankan      html  css  js  c++  java
  • PropertiesTest

    import java.io.FileInputStream;  
    import java.io.IOException;  
    import java.util.Properties;  
    
    public class PropertiesTest {
        
        public static Properties getConf(String filename){
            Properties prop = new Properties();  
            
            try {  
                //prop.load(PropertiesTest.class.getClassLoader().getResourceAsStream("config.properties")); //放在bin/下
                prop.load(new FileInputStream(filename));   //放在项目根目录
                /*System.out.println(prop.getProperty("database"));  
                System.out.println(prop.getProperty("dbuser"));  
                System.out.println(prop.getProperty("dbpassword"));*/
            } catch(IOException e) {  
                e.printStackTrace();  
            }
            return prop;  
        }
    
        public static void main(String[] args) {
            Properties prop = getConf("config.properties");
        }
    
    }
  • 相关阅读:
    springboot-配置文件
    system--属性
    url--web路径
    jquery--遍历
    javascript---知识点2
    iframe
    linux--磁盘挂载
    jquery--插件
    javascript窗口宽高
    vue--知识点
  • 原文地址:https://www.cnblogs.com/manhua/p/3708814.html
Copyright © 2011-2022 走看看