All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.riversoft.weixin.app.base.WxEndpoint Maven / Gradle / Ivy

The newest version!
package com.riversoft.weixin.app.base;

import com.riversoft.weixin.common.exception.WxRuntimeException;

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

/**
 * Created by exizhai on 9/26/2015.
 */
public class WxEndpoint {

    private static Properties endpoints;

    private static synchronized void loadProperties() {
        if (endpoints == null) {
            try {
                Properties properties = new Properties();
                InputStream inputStream = WxEndpoint.class.getClassLoader().getResourceAsStream("wx-app-endpoint.properties");
                properties.load(inputStream);
                endpoints = properties;
            } catch (IOException e) {
                throw new WxRuntimeException(999, "cannot find resource wx-app-endpoint.properties from classpath.");
            }
        }
    }

    public static String get(String key) {
        loadProperties();
        return endpoints.getProperty(key);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy