public class JAXBEncoder extends Object implements Encoder
Basic example with with Feign.Builder:
JAXBContextFactory jaxbFactory = new JAXBContextFactory.Builder()
.withMarshallerJAXBEncoding("UTF-8")
.withMarshallerSchemaLocation("http://apihost http://apihost/schema.xsd")
.build();
api = Feign.builder()
.encoder(new JAXBEncoder(jaxbFactory))
.target(MyApi.class, "http://api");
The JAXBContextFactory should be reused across requests as it caches the created JAXB contexts.
Encoder.DefaultMAP_STRING_WILDCARD| Constructor and Description |
|---|
JAXBEncoder(JAXBContextFactory jaxbContextFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
encode(Object object,
Type bodyType,
RequestTemplate template) |
public JAXBEncoder(JAXBContextFactory jaxbContextFactory)
public void encode(Object object, Type bodyType, RequestTemplate template)
Copyright © 2012–2022 OpenFeign. All rights reserved.