简体   繁体   中英

Can I use Spring integration modules in my Spring boot application?

I am trying to make a filedownload endpoint for my ftp server. I see that there is a Spring boot integration starter module for Spring boot but this module doesen't contain classes like DefaultFtpSessionFactory . I've read on the web that there are other modules available like Spring integration http and Spring integration ftp. However, these are not spring boot modules. Is it save to include those modules in my POM anyway? Or shoulden't I use Spring boot starter integration in the first place?

I see in this example: https://blog.pavelsklenar.com/spring-integration-sftp-upload-example/ That the author is using spring boot next to Spring Integration 4.3.8 regular Spring. He does say those are managed by Spring boot but i'm not exactly sure what he means by that.

Can anyone tell me what modules I should include if I want to make the download function? Thanks

Since it's unlikely that an application would require all Spring Integration modules (ftp, sftp, http, mqtt, ... etc), the starter only includes the core and java dsl jars on the classpath (in Spring Integration 5.0, the DSL is built in so boot 2.0 only includes the core jar).

Otherwise, you'd end up with many jars on the classpath that you don't need.

So, yes, you have to manually add the dependencies you need...

<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-ftp</artifactId>
</dependency>

Note that you don't need a <version/> - boot will manage that for you and bring in the right version corresponding to the core.

The modules themselves will bring in any additional transitive dependencies they need. So you just need to add the top level module(s) to your pom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM