package com.sptg.iot.api.feigns.fallback;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.iot.api.entity.IotSysConf;
import com.sptg.iot.api.feigns.IotSysConfFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author zwx
 * @create 2020/10/20 9:52
 */
@Component
@Slf4j
public class IotSysConfFeignFallbackFactory implements FallbackFactory<IotSysConfFeign> {

    @Override
    public IotSysConfFeign create(Throwable cause) {
        return new IotSysConfFeign() {
            @Override
            public IotSysConf findSysConfById(Long id) {
                log.error(cause.getMessage(), cause);
                return null;
            }
        };
    }
}
