@@ -0,0 +1,2658 @@
+package com.doctor.commons.core;%0A%0Aimport java.io.InputStream;%0Aimport java.util.Properties;%0A%0Aimport com.doctor.beaver.annotation.ThreadSafe;%0Aimport com.doctor.commons.StringUtils;%0A%0A/**%0A * Properties%E8%BE%85%E5%8A%A9%E5%B7%A5%E5%85%B7%E7%B1%BB%0A * %0A * @author sdcuike%0A *         %3Cp%3E%0A *         Created on 2016%E5%B9%B410%E6%9C%8810%E6%97%A5%0A *         %3Cp%3E%0A */%0A@ThreadSafe%0Apublic class PropertiesHelper %7B%0A    private Properties properties;%0A%0A    public PropertiesHelper(Properties properties) %7B%0A        this.properties = properties;%0A    %7D%0A%0A    public PropertiesHelper(String classpathPropertiesFileName) %7B%0A        Properties properties = new Properties();%0A        try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(classpathPropertiesFileName)) %7B%0A            properties.load(inputStream);%0A        %7D catch (Exception e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A    %7D%0A%0A    public String getString(String propertyName) %7B%0A        String value = properties.getProperty(propertyName);%0A        if (StringUtils.isBlank(value)) %7B%0A            return %22%22;%0A        %7D%0A        return value.trim();%0A    %7D%0A%0A    public String getString(String propertyName, String defaultValue) %7B%0A        String vlaue = getString(propertyName);%0A        if (StringUtils.isBlank(vlaue)) %7B%0A            return defaultValue;%0A        %7D%0A        return vlaue;%0A    %7D%0A%0A    public boolean getBoolean(String propertyName) %7B%0A        String value = properties.getProperty(propertyName);%0A        return Boolean.parseBoolean(value.trim());%0A    %7D%0A%0A    public boolean getBoolean(String propertyName, String defaultValue) %7B%0A        String value = properties.getProperty(propertyName);%0A        if (StringUtils.isBlank(value.trim())) %7B%0A            return Boolean.parseBoolean(defaultValue);%0A        %7D%0A        return Boolean.parseBoolean(value.trim());%0A    %7D%0A%0A    public long getLong(String propertyName) %7B%0A        String value = properties.getProperty(propertyName);%0A        return Long.valueOf(value.trim());%0A    %7D%0A%0A    public long getLong(String propertyName, String defaultValue) %7B%0A        String value = properties.getProperty(propertyName);%0A        if (StringUtils.isBlank(value)) %7B%0A            return Long.valueOf(defaultValue);%0A        %7D%0A        return Long.valueOf(value.trim());%0A    %7D%0A%0A    public int getInt(String propertyName) %7B%0A        String value = properties.getProperty(propertyName);%0A        return Integer.parseInt(value.trim());%0A    %7D%0A%0A    public int getInt(String propertyName, String defaultValue) %7B%0A        String value = properties.getProperty(propertyName);%0A        if (StringUtils.isBlank(value)) %7B%0A            return Integer.parseInt(defaultValue);%0A        %7D%0A        return Integer.parseInt(value.trim());%0A    %7D%0A%7D%0A

add Properties辅助工具类