zoukankan      html  css  js  c++  java
  • java 得到配置信息

    STEP1: 得到资源文件 com.carel.supervisor.base.config.supervisor.properties
    private static ResourceBundle resourceBundle = ResourceBundle.getBundle(
                "com.carel.supervisor.base.config.supervisor");

    STEP2: 
    resourceBundle.getString("PRODUCT_NAME");




    String name = "carel.properties";
    ClassLoader classLoader = Thread.currentThread()
                                                    .getContextClassLoader();
    URL url = classLoader.getResource(name);
    InputStream input = url.openStream();
    Properties newProperties = new Properties();
    newProperties.load(input);
     Enumeration keys = newProperties.keys();

     while (keys.hasMoreElements())
                {
                    String key = (String) keys.nextElement();

                    if (!propertiesTmp.containsKey(key))
                    {
                        propertiesTmp.setProperty(key,
                            newProperties.getProperty(key));
                        added = true;
                    }
                }



    读取XML类型的配置信息
    = classLoader.getResource(name);
    XMLNode xmlNode = XMLNode.parse(urlService.openStream());

    得到环境变量
    path = System.getenv(PVPRO_HOME);

  • 相关阅读:
    一般操作
    node express mongodb 数据录入
    express新版本后app.use(express.bodyParser())无效
    npm adduser报错问题
    01demo-mongodb
    Win32汇编--02必须了解的基础知识
    第17章 本书最后将学习什么呢(需要回头学习)
    第十六章 直接定址表(需要回头学)
    指令系统总结
    第十五章 外中断
  • 原文地址:https://www.cnblogs.com/kevinge/p/1280987.html
Copyright © 2011-2022 走看看