package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteConfigService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Description: 参数配置服务降级处理
 * @ClassName: RemoteConfigFallbackFactory
 * @Author  : xins
 * @Date    :2023-09-13  11:10
 * @Version :1.0
 */
@Component
public class RemoteConfigFallbackFactory implements FallbackFactory<RemoteConfigService> {
    @Override
    public RemoteConfigService create(Throwable throwable) {
        return new RemoteConfigService()
        {
            @Override
            public R<String> getConfigKeyStr(String configKey) {
                return R.fail("获取参数失败:" + throwable.getMessage());
            }
        };
    }
}
