public class JAXBEncoder
extends java.lang.Object
implements feign.codec.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.
| Constructor and Description |
|---|
JAXBEncoder(JAXBContextFactory jaxbContextFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
encode(java.lang.Object object,
java.lang.reflect.Type bodyType,
feign.RequestTemplate template) |
public JAXBEncoder(JAXBContextFactory jaxbContextFactory)