package com.xunmei.system.api.factory;

import com.xunmei.common.core.domain.R;
import com.xunmei.system.api.RemoteConfigService;
import com.xunmei.system.api.domain.SysConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteConfigFallbackFactory implements FallbackFactory<RemoteConfigService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteConfigFallbackFactory.class);
    @Override
    public RemoteConfigService create(Throwable throwable) {
        log.error("文件服务调用失败:{}", throwable.getMessage());
        return new RemoteConfigService() {
            @Override
            public R<SysConfig> findFirstByCode(String code, String source) {
                return null;
            }
        };
    }
}
