Package feign
Class Feign.Builder
- java.lang.Object
-
- feign.Feign.Builder
-
- Enclosing class:
- Feign
public static class Feign.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Feign
build()
Feign.Builder
client(Client client)
Feign.Builder
contract(Contract contract)
Feign.Builder
decode404()
This flag indicates that thedecoder
should process responses with 404 status, specifically returning null or empty instead of throwingFeignException
.Feign.Builder
decoder(Decoder decoder)
Feign.Builder
doNotCloseAfterDecode()
This flag indicates that the response should not be automatically closed upon completion of decoding the message.Feign.Builder
encoder(Encoder encoder)
Feign.Builder
errorDecoder(ErrorDecoder errorDecoder)
Feign.Builder
exceptionPropagationPolicy(ExceptionPropagationPolicy propagationPolicy)
Feign.Builder
invocationHandlerFactory(InvocationHandlerFactory invocationHandlerFactory)
Allows you to override how reflective dispatch works inside of Feign.Feign.Builder
logger(Logger logger)
Feign.Builder
logLevel(Logger.Level logLevel)
Feign.Builder
mapAndDecode(ResponseMapper mapper, Decoder decoder)
Allows to map the response before passing it to the decoder.Feign.Builder
options(Request.Options options)
Feign.Builder
queryMapEncoder(QueryMapEncoder queryMapEncoder)
Feign.Builder
requestInterceptor(RequestInterceptor requestInterceptor)
Adds a single request interceptor to the builder.Feign.Builder
requestInterceptors(java.lang.Iterable<RequestInterceptor> requestInterceptors)
Sets the full set of request interceptors for the builder, overwriting any previous interceptors.Feign.Builder
retryer(Retryer retryer)
<T> T
target(Target<T> target)
<T> T
target(java.lang.Class<T> apiType, java.lang.String url)
-
-
-
Method Detail
-
logLevel
public Feign.Builder logLevel(Logger.Level logLevel)
-
contract
public Feign.Builder contract(Contract contract)
-
client
public Feign.Builder client(Client client)
-
retryer
public Feign.Builder retryer(Retryer retryer)
-
logger
public Feign.Builder logger(Logger logger)
-
encoder
public Feign.Builder encoder(Encoder encoder)
-
decoder
public Feign.Builder decoder(Decoder decoder)
-
queryMapEncoder
public Feign.Builder queryMapEncoder(QueryMapEncoder queryMapEncoder)
-
mapAndDecode
public Feign.Builder mapAndDecode(ResponseMapper mapper, Decoder decoder)
Allows to map the response before passing it to the decoder.
-
decode404
public Feign.Builder decode404()
This flag indicates that thedecoder
should process responses with 404 status, specifically returning null or empty instead of throwingFeignException
. All first-party (ex gson) decoders return well-known empty values defined byUtil.emptyValueOf(java.lang.reflect.Type)
. To customize further, wrap an existingdecoder
or make your own. This flag only works with 404, as opposed to all or arbitrary status codes. This was an explicit decision: 404 -> empty is safe, common and doesn't complicate redirection, retry or fallback policy. If your server returns a different status for not-found, correct via a customclient
.- Since:
- 8.12
-
errorDecoder
public Feign.Builder errorDecoder(ErrorDecoder errorDecoder)
-
options
public Feign.Builder options(Request.Options options)
-
requestInterceptor
public Feign.Builder requestInterceptor(RequestInterceptor requestInterceptor)
Adds a single request interceptor to the builder.
-
requestInterceptors
public Feign.Builder requestInterceptors(java.lang.Iterable<RequestInterceptor> requestInterceptors)
Sets the full set of request interceptors for the builder, overwriting any previous interceptors.
-
invocationHandlerFactory
public Feign.Builder invocationHandlerFactory(InvocationHandlerFactory invocationHandlerFactory)
Allows you to override how reflective dispatch works inside of Feign.
-
doNotCloseAfterDecode
public Feign.Builder doNotCloseAfterDecode()
This flag indicates that the response should not be automatically closed upon completion of decoding the message. This should be set if you plan on processing the response into a lazy-evaluated construct, such as aIterator
. Feign standard decoders do not have built in support for this flag. If you are using this flag, you MUST also use a custom Decoder, and be sure to close all resources appropriately somewhere in the Decoder (you can useUtil.ensureClosed(java.io.Closeable)
for convenience).- Since:
- 9.6
-
exceptionPropagationPolicy
public Feign.Builder exceptionPropagationPolicy(ExceptionPropagationPolicy propagationPolicy)
-
target
public <T> T target(java.lang.Class<T> apiType, java.lang.String url)
-
target
public <T> T target(Target<T> target)
-
build
public Feign build()
-
-