I have the following xslt-transformer in Spring-Integration. How can I do the same configuration with Java Config?
<si-xml:xslt-transformer input-channel="input" output-channel="output"
xsl-resource="classpath:/test.xsl"
result-transformer="resultToDoc"/>
@Transformer(inputChannel = "input", outputChannel = "output")
@Bean
public XsltPayloadTransformer transformer() {
return new XsltPayloadTransformer(new ClassPathResource("classpath:/test.xsl"),
resultToDoc());
}
From other side consider to use Spring Integration Java DSL, where the same will me much simpler:
@Value("classpath:/test.xsl")
private Resource xsl;
.transform(Transformers.xslt(this.xsl))
@ServiceActivator(inputChannel="input")
@Bean
public MessageHandler xsltt() {
MessageTransformingHandler handler = new MessageTransformingHandler(transformer());
handler.setOutputChannelName("output");
return handler;
}
@Bean
public Transformer transformer() {
return new XsltPayloadTransformer(new ClassPathResource("classpath:/test.xsl"),
resultToDoc());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With