Package com.alphacsp.common.util

Source Code of com.alphacsp.common.util.PropertiesUtils

package com.alphacsp.common.util;

import org.springframework.core.io.Resource;
import org.springframework.util.DefaultPropertiesPersister;
import org.springframework.util.PropertiesPersister;

import java.io.IOException;
import java.util.Properties;

/**
* @author Yoav Hakman
*/
public abstract class PropertiesUtils {

    public static Properties readProperties(Resource propertiesFile) {
        PropertiesPersister propertiesPersister = new DefaultPropertiesPersister();
        Properties properties = new Properties();
        try {
            propertiesPersister.load(properties, propertiesFile.getInputStream());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return properties;
    }

}
TOP

Related Classes of com.alphacsp.common.util.PropertiesUtils

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.