package com.platform.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * 名称：ResourceUtil <br>
 * 描述：参数工具类<br>
 *
 * @author 李鹏军
 * @version 1.0
 * @since 1.0.0
 */
@Component
public class ResourceUtil implements ApplicationContextAware {

    private static Environment environment;


    public static String getConfigByName(String name) {
        return environment.getProperty(name);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ResourceUtil.environment = applicationContext.getEnvironment();
    }
}
