<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      java 自定義讀取properties配置文件屬性

      把屬性存到一個map里,并提供get方法,如果沒有獲取到值,則重新加載一遍配置文件,重新賦值,從而刷新數package com.aaa.demo.testProperties;

      import java.io.IOException;
      import java.io.InputStream;
      import java.util.Enumeration;
      import java.util.HashMap;
      import java.util.Map;
      import java.util.Properties;
      
      /**
       * projectName: testSpring
       *
       * @author: 
       * time: 2023/8/1 18:11
       * description:
       */
      public class TestProPerties {
      
          private static Map propertiesMap = new HashMap();

          public static void main(String[] args) throws IOException {
              String name = getValue("name");
              System.out.println(name);
          }
      /**
           * 獲取值,沒有值的話會重新從properties配置文件加載一遍
           * @param key
           * @return
           * @throws IOException
           */
          public static String getValue(String key) throws IOException {
              String value = (String) propertiesMap.get(key);
      
              if (value == null || value.length() < 1) {
                  TestProPerties testProPerties = new TestProPerties();
                  testProPerties.refresh();
                  return (String) propertiesMap.get(key);
              }else {
                  return value;
              }
          }
      
      
          /**
           * 刷新數據
           * @throws IOException
           */
          public void refresh() throws IOException {
      
              //獲取配置文件,要注意路徑問題,路徑不對會找不到文件,當前文件在SRC根目錄下
              InputStream is = this.getClass().getResourceAsStream("/test11.properties");
      
              Properties prop= new Properties();
              prop.load(is);
              is.close();
      
              Enumeration<?> enumeration = prop.propertyNames();
              while (enumeration.hasMoreElements()) {
                  String o = (String) enumeration.nextElement();
                  propertiesMap.put(o, prop.get(o));
              }
          }
      }

       

      posted @ 2023-08-01 19:19  何足道66  閱讀(69)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 日本一区二区三区四区黄色| 亚洲av永久无码精品天堂久久| 中文字幕日韩人妻一区| 国产午夜福利av在线麻豆| 精品国产成人午夜福利| 久久99精品国产99久久6尤物| 四虎亚洲国产成人久久精品| 色综合天天综合天天综| 亚洲一区二区三区影院| 锡林浩特市| Y111111国产精品久久久| 中文字幕在线不卡一区二区| 溧阳市| 人妻丰满熟妇av无码处处不卡| 老师扒下内裤让我爽了一夜 | 中国女人高潮hd| 免费拍拍拍网站| 视频网站在线观看不卡| 欧美性群另类交| 免费观看日本污污ww网站69| 99久久国产综合精品女图图等你| 男女性高爱潮免费网站| 久久无码av中文出轨人妻| 国产激情一区二区三区不卡| 99中文字幕精品国产| 久草热久草热线频97精品 | 日本边添边摸边做边爱| 在线看片免费人成视久网| 少妇人妻88久久中文字幕| 久久青青草原精品国产app| 亚洲美女av一区二区| 欧美videosdesexo吹潮| 蜜臀av午夜精品福利| 深夜精品免费在线观看| 成人片黄网站色大片免费毛片| 国产成人精品亚洲精品密奴| 久久久久久久久久久国产| 成人av一区二区亚洲精| 国产午夜亚洲精品福利| 高台县| 亚洲日产韩国一二三四区|