[JAVA-27743] Upgraded spring-integration module to spring 6 & java 17 (#15343)

This commit is contained in:
panos-kakos 2023-12-04 13:11:26 +02:00 committed by GitHub
parent c6307d20ae
commit 67e11e004e
2 changed files with 21 additions and 23 deletions

View File

@ -17,7 +17,6 @@
</parent> </parent>
<dependencies> <dependencies>
<!-- Testing -->
<dependency> <dependency>
<groupId>org.springframework.integration</groupId> <groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId> <artifactId>spring-integration-core</artifactId>
@ -29,11 +28,6 @@
<version>${javax-activation.version}</version> <version>${javax-activation.version}</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>${javax-mail.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.integration</groupId> <groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-twitter</artifactId> <artifactId>spring-integration-twitter</artifactId>
@ -85,16 +79,21 @@
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>${h2.version}</version> <version>${h2.version}</version>
</dependency> </dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>${postgresql.version}</version> <version>${postgresql.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
<version>${jakarta.mail.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -124,14 +123,13 @@
</build> </build>
<properties> <properties>
<spring.version>5.1.13.RELEASE</spring.version> <spring.version>6.0.0</spring.version>
<spring-social.version>1.1.4.RELEASE</spring-social.version> <spring-social.version>1.1.4.RELEASE</spring-social.version>
<spring-integration-twitter.version>5.0.13.RELEASE</spring-integration-twitter.version> <spring-integration-twitter.version>5.0.13.RELEASE</spring-integration-twitter.version>
<javax-mail.version>1.4.7</javax-mail.version>
<javax-activation.version>1.1.1</javax-activation.version> <javax-activation.version>1.1.1</javax-activation.version>
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version> <maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
<jaxb-api.version>2.3.0</jaxb-api.version>
<postgresql.version>42.3.8</postgresql.version> <postgresql.version>42.3.8</postgresql.version>
<jakarta.mail.version>2.0.1</jakarta.mail.version>
</properties> </properties>
</project> </project>

View File

@ -1,6 +1,7 @@
package com.baeldung.dsl; package com.baeldung.dsl;
import java.io.File; import java.io.File;
import java.time.Duration;
import java.util.Scanner; import java.util.Scanner;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -14,7 +15,6 @@ import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.core.GenericSelector; import org.springframework.integration.core.GenericSelector;
import org.springframework.integration.core.MessageSource; import org.springframework.integration.core.MessageSource;
import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.Pollers; import org.springframework.integration.dsl.Pollers;
import org.springframework.integration.dsl.MessageChannels; import org.springframework.integration.dsl.MessageChannels;
import org.springframework.integration.file.FileReadingMessageSource; import org.springframework.integration.file.FileReadingMessageSource;
@ -69,7 +69,7 @@ public class JavaDSLFileCopyConfig {
@Bean @Bean
public IntegrationFlow fileMover() { public IntegrationFlow fileMover() {
return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000))) return IntegrationFlow.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000)))
.filter(onlyJpgs()) .filter(onlyJpgs())
.handle(targetDirectory()) .handle(targetDirectory())
.get(); .get();
@ -77,7 +77,7 @@ public class JavaDSLFileCopyConfig {
// @Bean // @Bean
public IntegrationFlow fileMoverWithLambda() { public IntegrationFlow fileMoverWithLambda() {
return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000))) return IntegrationFlow.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000)))
.filter(message -> ((File) message).getName() .filter(message -> ((File) message).getName()
.endsWith(".jpg")) .endsWith(".jpg"))
.handle(targetDirectory()) .handle(targetDirectory())
@ -92,7 +92,7 @@ public class JavaDSLFileCopyConfig {
// @Bean // @Bean
public IntegrationFlow fileMoverWithPriorityChannel() { public IntegrationFlow fileMoverWithPriorityChannel() {
return IntegrationFlows.from(sourceDirectory()) return IntegrationFlow.from(sourceDirectory())
.filter(onlyJpgs()) .filter(onlyJpgs())
.channel("alphabetically") .channel("alphabetically")
.handle(targetDirectory()) .handle(targetDirectory())
@ -113,7 +113,7 @@ public class JavaDSLFileCopyConfig {
// @Bean // @Bean
public IntegrationFlow fileReader() { public IntegrationFlow fileReader() {
return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10))) return IntegrationFlow.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10)))
.filter(onlyJpgs()) .filter(onlyJpgs())
.channel("holdingTank") .channel("holdingTank")
.get(); .get();
@ -121,16 +121,16 @@ public class JavaDSLFileCopyConfig {
// @Bean // @Bean
public IntegrationFlow fileWriter() { public IntegrationFlow fileWriter() {
return IntegrationFlows.from("holdingTank") return IntegrationFlow.from("holdingTank")
.bridge(e -> e.poller(Pollers.fixedRate(1, TimeUnit.SECONDS, 20))) .bridge(e -> e.poller(Pollers.fixedRate(Duration.of(1, TimeUnit.SECONDS.toChronoUnit()), Duration.of(20, TimeUnit.SECONDS.toChronoUnit()))))
.handle(targetDirectory()) .handle(targetDirectory())
.get(); .get();
} }
// @Bean // @Bean
public IntegrationFlow anotherFileWriter() { public IntegrationFlow anotherFileWriter() {
return IntegrationFlows.from("holdingTank") return IntegrationFlow.from("holdingTank")
.bridge(e -> e.poller(Pollers.fixedRate(2, TimeUnit.SECONDS, 10))) .bridge(e -> e.poller(Pollers.fixedRate(Duration.of(2, TimeUnit.SECONDS.toChronoUnit()), Duration.of(10, TimeUnit.SECONDS.toChronoUnit()))))
.handle(anotherTargetDirectory()) .handle(anotherTargetDirectory())
.get(); .get();
} }