package com.tofly.auth.feign.factory;

import com.tofly.auth.feign.BaseUserService;
import com.tofly.auth.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;
    }
}
