diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/AbstractFtpInboundChannelAdapterParser.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/AbstractFtpInboundChannelAdapterParser.java index c1d3af385e..aaa0477637 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/AbstractFtpInboundChannelAdapterParser.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/config/AbstractFtpInboundChannelAdapterParser.java @@ -45,8 +45,8 @@ public abstract class AbstractFtpInboundChannelAdapterParser extends AbstractPol BeanDefinitionBuilder synchronizerBuilder = BeanDefinitionBuilder.genericBeanDefinition("org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizer"); + synchronizerBuilder.addConstructorArgValue(poolBuilder.getBeanDefinition()); IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "remote-directory", "remotePath"); - synchronizerBuilder.addPropertyValue("sessionFactory", poolBuilder.getBeanDefinition()); // IntegrationNamespaceUtils.setValueIfAttributeDefined(synchronizerBuilder, element, "auto-delete-remote-files-on-sync", "shouldDeleteSourceFile"); // // diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundFileSynchronizer.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundFileSynchronizer.java index 2a872a5be2..3afc2ed6b1 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundFileSynchronizer.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundFileSynchronizer.java @@ -48,14 +48,14 @@ public class FtpInboundFileSynchronizer extends AbstractInboundFileSynchronizer< /** - * The {@link org.springframework.integration.ftp.session.FtpClientPool} that holds references to {@link org.apache.commons.net.ftp.FTPClient} instances - * - * @param clientPool the {@link org.springframework.integration.ftp.session.FtpClientPool} + * Create a synchronizer with the {@link SessionFactory} used to acquire {@link Session} instances. */ - public void setSessionFactory(SessionFactory sessionFactory) { + public FtpInboundFileSynchronizer(SessionFactory sessionFactory) { + Assert.notNull(sessionFactory, "sessionFactory must not be null"); this.sessionFactory = sessionFactory; } + public void setRemotePath(String remotePath) { this.remotePath = remotePath; } diff --git a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTest.java b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTest.java index ce59e8807e..ebc3055c06 100644 --- a/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTest.java +++ b/spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizerTest.java @@ -76,8 +76,7 @@ public class FtpInboundRemoteFileSystemSynchronizerTest { FtpInboundFileSynchronizingMessageSource ms = new FtpInboundFileSynchronizingMessageSource(); - FtpInboundFileSynchronizer synchronizer = spy(new FtpInboundFileSynchronizer()); - synchronizer.setSessionFactory(ftpSessionFactory); + FtpInboundFileSynchronizer synchronizer = spy(new FtpInboundFileSynchronizer(ftpSessionFactory)); synchronizer.setShouldDeleteSourceFile(true); synchronizer.setRemotePath("remote-test-dir"); synchronizer.setFilter(new FtpPatternMatchingFileListFilter(".*\\.test$"));