Fix no factory bean warnings

This commit is contained in:
David Turanski
2020-08-19 12:37:15 -04:00
parent 61ec16d100
commit edfe13e745
3 changed files with 13 additions and 13 deletions

View File

@@ -88,7 +88,7 @@ public class FtpSupplierConfiguration {
}
@Bean
public MessageSource<File> ftpMessageSource() {
public FtpInboundChannelAdapterSpec ftpMessageSource() {
FtpInboundChannelAdapterSpec messageSourceBuilder = Ftp.inboundAdapter(ftpSessionFactory)
.preserveTimestamp(this.ftpSupplierProperties.isPreserveTimestamp())
.remoteDirectory(this.ftpSupplierProperties.getRemoteDir())
@@ -110,7 +110,7 @@ public class FtpSupplierConfiguration {
chainFileListFilter.addFilter(new FtpPersistentAcceptOnceFileListFilter(this.metadataStore, "ftpSource/"));
messageSourceBuilder.filter(chainFileListFilter);
return messageSourceBuilder.get();
return messageSourceBuilder;
}
@Bean
@@ -127,7 +127,7 @@ public class FtpSupplierConfiguration {
@ConditionalOnExpression("environment['file.consumer.mode'] != 'ref'")
public Publisher<Message<Object>> ftpReadingFlow() {
return FileUtils.enhanceFlowForReadingMode(IntegrationFlows
.from(IntegrationReactiveUtils.messageSourceToFlux(ftpMessageSource())), fileConsumerProperties)
.from(IntegrationReactiveUtils.messageSourceToFlux(ftpMessageSource().get())), fileConsumerProperties)
.toReactivePublisher();
}

View File

@@ -40,7 +40,6 @@ import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
properties = {
"debug=true",
"ftp.factory.username = foo",
"ftp.factory.password = foo",
"file.consumer.mode = ref",

View File

@@ -54,6 +54,7 @@ import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.handler.MessageProcessor;
import org.springframework.integration.metadata.ConcurrentMetadataStore;
import org.springframework.integration.sftp.dsl.Sftp;
import org.springframework.integration.sftp.dsl.SftpInboundChannelAdapterSpec;
import org.springframework.integration.sftp.filters.SftpPersistentAcceptOnceFileListFilter;
import org.springframework.integration.sftp.filters.SftpRegexPatternFileListFilter;
import org.springframework.integration.sftp.session.SftpRemoteFileTemplate;
@@ -79,8 +80,8 @@ import org.springframework.util.StringUtils;
*/
@Configuration
@EnableConfigurationProperties({SftpSupplierProperties.class, FileConsumerProperties.class})
@Import({SftpSupplierFactoryConfiguration.class})
@EnableConfigurationProperties({ SftpSupplierProperties.class, FileConsumerProperties.class })
@Import({ SftpSupplierFactoryConfiguration.class })
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
public class SftpSupplierConfiguration {
@@ -199,10 +200,10 @@ public class SftpSupplierConfiguration {
FileConsumerProperties fileConsumerProperties) {
return FileUtils.enhanceStreamFlowForReadingMode(IntegrationFlows
.from(IntegrationReactiveUtils.messageSourceToFlux(sftpMessageSource)
.subscriberContext(
context -> (context.put(IntegrationReactiveUtils.DELAY_WHEN_EMPTY_KEY,
sftpSupplierProperties.getDelayWhenEmpty())))),
.from(IntegrationReactiveUtils.messageSourceToFlux(sftpMessageSource)
.subscriberContext(
context -> (context.put(IntegrationReactiveUtils.DELAY_WHEN_EMPTY_KEY,
sftpSupplierProperties.getDelayWhenEmpty())))),
fileConsumerProperties)
.toReactivePublisher();
}
@@ -234,7 +235,7 @@ public class SftpSupplierConfiguration {
FileConsumerProperties fileConsumerProperties) {
return FileUtils.enhanceFlowForReadingMode(IntegrationFlows
.from(IntegrationReactiveUtils.messageSourceToFlux(sftpMessageSource)),
.from(IntegrationReactiveUtils.messageSourceToFlux(sftpMessageSource)),
fileConsumerProperties)
.toReactivePublisher();
}
@@ -245,7 +246,7 @@ public class SftpSupplierConfiguration {
*/
@ConditionalOnExpression("environment['sftp.supplier.list-only'] != 'true'")
@Bean
public MessageSource targetMessageSource(SftpSupplierProperties sftpSupplierProperties,
public SftpInboundChannelAdapterSpec targetMessageSource(SftpSupplierProperties sftpSupplierProperties,
SftpSupplierFactoryConfiguration.DelegatingFactoryWrapper delegatingFactoryWrapper,
FileListFilter<LsEntry> fileListFilter) {
@@ -260,7 +261,7 @@ public class SftpSupplierConfiguration {
.temporaryFileSuffix(sftpSupplierProperties.getTmpFileSuffix())
.metadataStorePrefix(METADATA_STORE_PREFIX)
.maxFetchSize(sftpSupplierProperties.getMaxFetch())
.filter(fileListFilter).get();
.filter(fileListFilter);
}
}