Spring 集成中的 Marshaller
我正在尝试在 spring 集成中将 java 对象编组为 xml。我尝试使用新的 MarshallingTransformer。但我不知道如何将编组器传递给它。 这是我的代码:
return IntegrationFlows.from(Http.inboundGateway("/foo")
.requestMapping(m -> m.methods(HttpMethod.POST)
)
)
.transform(xmlToObjectTransformer)
.convert(Customer.class)
.transform(new MarshallingTransformer("the marshaller should come here"))
.get();
I am trying to marshal java objects to xml in spring integration. i've tried to use new MarshallingTransformer. but i don't know how to pass the marshaller into it.
This is my code:
return IntegrationFlows.from(Http.inboundGateway("/foo")
.requestMapping(m -> m.methods(HttpMethod.POST)
)
)
.transform(xmlToObjectTransformer)
.convert(Customer.class)
.transform(new MarshallingTransformer("the marshaller should come here"))
.get();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题不清楚。
您可能需要了解这些编组器是什么以及如何配置它们: https://docs.spring.io/spring-framework/docs/current/reference/html/data-access.html#oxm。
然后,您只需要为相应的
Marshaller
提供一个 bean,并将其注入到该MarshallingTransformer
ctor 中。The question is not clear.
You probably need to learn what are those marshallers and how to configure them: https://docs.spring.io/spring-framework/docs/current/reference/html/data-access.html#oxm.
Then you just need to have a bean for respective
Marshaller
and inject it into thatMarshallingTransformer
ctor.