如何在Spring集成中使用JAVA配置创建xslt-transformer?

时间:2016-03-17 12:22:59

标签: java xml spring xslt spring-integration

我在Spring-Integration中有以下xslt-transformer。如何使用Java Config进行相同的配置?

os.path

2 个答案:

答案 0 :(得分:2)

contains(.,'Matched to full address')

从另一方面考虑使用Spring Integration Java DSL,在那里我会更简单:

@Transformer(inputChannel = "input", outputChannel = "output")
@Bean
public XsltPayloadTransformer transformer() {
    return new XsltPayloadTransformer(new ClassPathResource("classpath:/test.xsl"),
            resultToDoc());
}

答案 1 :(得分:1)

@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());
}