What are the advantages of Spring Integration using XML over using Java DSL? I find that all docs are written using XML declarative format, however, I personally find it easier to write Java code rather than XML. Is there any reason for reconsidering my view point?
There is no "difference" at runtime; only XML was available originally; we are adding more DSL examples to the docs/samples over time. e.g. https://docs.spring.io/spring-integration/reference/html/sftp.html#configuring-with-the-java-dsl
@SpringBootApplication
public class SftpJavaApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(SftpJavaApplication.class)
.web(false)
.run(args);
}
@Bean
public IntegrationFlow sftpInboundFlow() {
return IntegrationFlows
.from(Sftp.inboundAdapter(this.sftpSessionFactory)
.preserveTimestamp(true)
.remoteDirectory("foo")
.regexFilter(".*\\.txt$")
.localFilenameExpression("#this.toUpperCase() + '.a'")
.localDirectory(new File("sftp-inbound")),
e -> e.id("sftpInboundAdapter")
.autoStartup(true)
.poller(Pollers.fixedDelay(5000)))
.handle(m -> System.out.println(m.getPayload()))
.get();
}
}
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