package com.tofly.auth.feign.factory;

import com.tofly.auth.feign.BaseUserLoginService;
import com.tofly.auth.feign.fallback.BaseUserLoginServiceFallbackImpl;
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 BaseUserLoginServiceFallbackFactory implements FallbackFactory<BaseUserLoginService> {
    @Override
    public BaseUserLoginService create(Throwable throwable) {
        BaseUserLoginService baseUserService=new BaseUserLoginServiceFallbackImpl();
        ((BaseUserServiceFallbackImpl) baseUserService).setThrowable(throwable);
        return baseUserService;
    }
}
