3 changed files with 32 additions and 3 deletions
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
||||
|
import com.epmet.feign.GovAccessFeignClient; |
||||
|
import feign.hystrix.FallbackFactory; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Description fallBackFactory,用于抛出异常之后,返回一个Fallback降级处理对象 |
||||
|
* @author wxz |
||||
|
* @date 2021.07.15 09:54:14 |
||||
|
*/ |
||||
|
@Component |
||||
|
@Slf4j |
||||
|
public class GovAccessFeignClientFallBackFactory implements FallbackFactory<GovAccessFeignClient> { |
||||
|
|
||||
|
/** |
||||
|
* 降级处理对象 |
||||
|
*/ |
||||
|
private GovAccessFeignClientFallBack fallBack = new GovAccessFeignClientFallBack(); |
||||
|
|
||||
|
@Override |
||||
|
public GovAccessFeignClient create(Throwable cause) { |
||||
|
log.error(ExceptionUtils.getThrowableErrorStackTrace(cause)); |
||||
|
return fallBack; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue