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);

  • 相关阅读:
    rem 适配
    1px实现方案
    伪类选择器
    css中如何做到容器按比例缩放
    rem移动端适配方案
    Quartz.NET实现作业调度
    iPhone X
    优化hexo访问速度-将hexo部署到云主机VPS
    网页设计命名规范
    网站注册页面
  • 原文地址:https://www.cnblogs.com/kevinge/p/1280987.html
Copyright © 2011-2022 走看看