@Test public void test() { NoarkPropertiesLoader loader = new NoarkPropertiesLoader(); Map<String, String> config = loader.loadProperties("dev"); assertTrue("中国".equals(config.get("noark.key.test"))); assertTrue("2".equals(config.get("noark.server.id"))); assertTrue("2 server".equals(config.get("noark.server.name"))); }
Map<String, String> loadProperties(String profile) { final ClassLoader loader = Noark.class.getClassLoader(); HashMap<String, String> result = new HashMap<>(256, 1); loadProperties(loader, DEFAULT_PROPERTIES, result); if (StringUtils.isNotEmpty(profile)) { loadProperties(loader, PROFILE_PREFIX + profile + PROFILE_SUFFIX, result); } else { loadProperties(loader, TEST_PROPERTIES, result); } final StringEncryptor encryptor = new StringEncryptor(result); for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(encryptor.decrypt(e.getValue())); } for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(EnvConfigHolder.fillExpression(e.getValue(), result, true)); } result.put(NoarkConstant.NOARK_VERSION, Noark.getVersion()); return result; }
NoarkPropertiesLoader { Map<String, String> loadProperties(String profile) { final ClassLoader loader = Noark.class.getClassLoader(); HashMap<String, String> result = new HashMap<>(256, 1); loadProperties(loader, DEFAULT_PROPERTIES, result); if (StringUtils.isNotEmpty(profile)) { loadProperties(loader, PROFILE_PREFIX + profile + PROFILE_SUFFIX, result); } else { loadProperties(loader, TEST_PROPERTIES, result); } final StringEncryptor encryptor = new StringEncryptor(result); for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(encryptor.decrypt(e.getValue())); } for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(EnvConfigHolder.fillExpression(e.getValue(), result, true)); } result.put(NoarkConstant.NOARK_VERSION, Noark.getVersion()); return result; } }
NoarkPropertiesLoader { Map<String, String> loadProperties(String profile) { final ClassLoader loader = Noark.class.getClassLoader(); HashMap<String, String> result = new HashMap<>(256, 1); loadProperties(loader, DEFAULT_PROPERTIES, result); if (StringUtils.isNotEmpty(profile)) { loadProperties(loader, PROFILE_PREFIX + profile + PROFILE_SUFFIX, result); } else { loadProperties(loader, TEST_PROPERTIES, result); } final StringEncryptor encryptor = new StringEncryptor(result); for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(encryptor.decrypt(e.getValue())); } for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(EnvConfigHolder.fillExpression(e.getValue(), result, true)); } result.put(NoarkConstant.NOARK_VERSION, Noark.getVersion()); return result; }  }
NoarkPropertiesLoader { Map<String, String> loadProperties(String profile) { final ClassLoader loader = Noark.class.getClassLoader(); HashMap<String, String> result = new HashMap<>(256, 1); loadProperties(loader, DEFAULT_PROPERTIES, result); if (StringUtils.isNotEmpty(profile)) { loadProperties(loader, PROFILE_PREFIX + profile + PROFILE_SUFFIX, result); } else { loadProperties(loader, TEST_PROPERTIES, result); } final StringEncryptor encryptor = new StringEncryptor(result); for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(encryptor.decrypt(e.getValue())); } for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(EnvConfigHolder.fillExpression(e.getValue(), result, true)); } result.put(NoarkConstant.NOARK_VERSION, Noark.getVersion()); return result; }   }
NoarkPropertiesLoader { Map<String, String> loadProperties(String profile) { final ClassLoader loader = Noark.class.getClassLoader(); HashMap<String, String> result = new HashMap<>(256, 1); loadProperties(loader, DEFAULT_PROPERTIES, result); if (StringUtils.isNotEmpty(profile)) { loadProperties(loader, PROFILE_PREFIX + profile + PROFILE_SUFFIX, result); } else { loadProperties(loader, TEST_PROPERTIES, result); } final StringEncryptor encryptor = new StringEncryptor(result); for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(encryptor.decrypt(e.getValue())); } for (Map.Entry<String, String> e : result.entrySet()) { e.setValue(EnvConfigHolder.fillExpression(e.getValue(), result, true)); } result.put(NoarkConstant.NOARK_VERSION, Noark.getVersion()); return result; }    }