package com.jeeplus.sys.factory;

import com.jeeplus.sys.feign.IConfigApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 配置信息服务降级处理
 *
 * @author jeeplus
 */

@Slf4j
@Component
public class ConfigApiFallbackFactory implements FallbackFactory <IConfigApi> {
    @Override
    public IConfigApi create(Throwable throwable) {
        log.error ( "配置服务调用失败:{}", throwable.getMessage ( ) );
        throwable.printStackTrace ( );
        return new IConfigApi ( ) {

            @Override
            public String getProductName(String tenantId) {
                return null;
            }
        };
    }
}
