package net.joystart.common.util; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.stereotype.Component; /** * * @author yang yanqing * @date 2016年7月7日 * ConfigUtil 系统配置文件参获取类 */ @Component public class ConfigUtil { private ConfigUtil(){ } public static Properties pro = new Properties(); static{ Resource resource = new ClassPathResource("/config.properties", ConfigUtil.class); try (InputStream inputStream = resource.getInputStream()){ if(null !=inputStream){ pro.load(inputStream); } } catch (IOException e) { e.printStackTrace(); } } }