package com.jeeplus.sys.factory;

import com.jeeplus.sys.domain.Area;
import com.jeeplus.sys.feign.IAreaApi;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

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

            @Override
            public List<Area> getAreaDTOByName(String name) {
                return null;
            }
        };
    }
}
