PropertyUtil.java 567 B

12345678910111213141516171819202122
  1. package com.persagy.framework.util;
  2. import java.io.IOException;
  3. import java.util.Properties;
  4. public class PropertyUtil {
  5. public static String getProperty(String key, String propertyFilePath) {
  6. Properties properties = new Properties();
  7. try {
  8. properties.load(PropertyUtil.class.getResourceAsStream(propertyFilePath));
  9. } catch (IOException e) {
  10. e.printStackTrace();
  11. }
  12. String value = properties.getProperty(key);
  13. return value;
  14. }
  15. public static String getSystemProperty(String key) {
  16. return getProperty(key, "/config/system.properties");
  17. }
  18. }