package com.tofly.base.api.feign.factory;

import com.tofly.base.api.feign.BaseUserService;
import com.tofly.base.api.feign.fallback.BaseUserServiceFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 * @date 2019/9/6  15:53
 */
@Component
public class BaseUserServiceFallbackFactory implements FallbackFactory<BaseUserService> {
    @Override
    public BaseUserService create(Throwable throwable) {
        BaseUserService baseUserService=new BaseUserServiceFallbackImpl();
        ((BaseUserServiceFallbackImpl) baseUserService).setThrowable(throwable);
        return baseUserService;
    }
}
