- Created the Jaxb2Marshaller object.
- Need to convert a java POJO to XML (Marshalling).
Need help in integrating Jaxb2Marshaller in the Integration Route.
Code flow:-
@Bean
public IntegrationFlow flow() throws JAXBException {
return from(...).
.enrichHeaders(...)
.handle(...)
.transform(processor()::generateXml)
.channel(...)
.get();
}
How can I add Jaxb2Marshaller in transform() step?
There is an out-of-the-box transformer to use:
https://docs.spring.io/spring-integration/docs/current/reference/html/xml.html#xml-marshalling-transformer
How to create a
Jaxb2Marshalleryou can consult Spring Framework docs:https://docs.spring.io/spring/docs/current/spring-framework-reference/data-access.html#oxm-jaxb2