class AbstractConfig implements Serializable {

    public void refresh() {
        try {

            // getPrefix为对应配置类的前缀，ProviderConfig->Provider, ServiceBean->Service,
            // getId为beanId,
            CompositeConfiguration compositeConfiguration = Environment.getInstance().getConfiguration(getPrefix(), getId());
            InmemoryConfiguration config = new InmemoryConfiguration(getPrefix(), getId());
            config.addProperties(getMetaData()); // Bean对象的初始值
            if (Environment.getInstance().isConfigCenterFirst()) {
                // 注释顺序错了...The sequence would be: SystemConfiguration -> ExternalConfiguration -> AppExternalConfiguration -> AbstractConfig -> PropertiesConfiguration
                // -D系统属性 > 配置中心应用配置 > 配置中心全局配置 > Bean对象的初始值 > 属性文件中的信息
                compositeConfiguration.addConfiguration(3, config);
            } else {
                // 注释顺序错了...The sequence would be: SystemConfiguration -> AbstractConfig -> ExternalConfiguration -> AppExternalConfiguration -> PropertiesConfiguration
                // -D > Bean对象的初始值 > 配置中心应用配置 > 配置中心全局配置 > 属性文件中的信息
                compositeConfiguration.addConfiguration(1, config);
            }

            // loop methods, get override value and set the new value back to method
            Method[] methods = getClass().getMethods();
            for (Method method : methods) {
                if (ClassHelper.isSetter(method)) {
                    try {
                        // 截取set方法作为key，从配置中获取值
                        String value = compositeConfiguration.getString(extractPropertyName(getClass(), method));
                        // isTypeMatch() is called to avoid duplicate and incorrect update, for example, we have two 'setGeneric' methods in ReferenceConfig.
                        if (StringUtils.isNotEmpty(value) && ClassHelper.isTypeMatch(method.getParameterTypes()[0], value)) {
                            // 执行set
                            method.invoke(this, ClassHelper.convertPrimitive(method.getParameterTypes()[0], value));
                        }
                    } catch (NoSuchMethodException e) {
                        logger.info("Failed to override the property " + method.getName() + " in " +
                                this.getClass().getSimpleName() +
                                ", please make sure every property has getter/setter method provided.");
                    }
                }
            }
        } catch (Exception e) {
            logger.error("Failed to override ", e);
        }
    }

}