Spring FTP 入站渠道不工作
Spring FTP Inbound channel not working
我正在尝试使用 FtpInboundFileSynchronizer 但无法修复它。它没有报告任何问题,也没有工作。我指的是代码
http://docs.spring.io/spring-integration/reference/html/ftp.html#_configuring_with_java_configuration_10
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.log4j.Logger;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.file.filters.AcceptOnceFileListFilter;
import org.springframework.integration.file.remote.session.CachingSessionFactory;
import org.springframework.integration.file.remote.session.Session;
import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.ftp.filters.FtpSimplePatternFileListFilter;
import org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizer;
import org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizingMessageSource;
import org.springframework.integration.ftp.session.DefaultFtpSessionFactory;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
@SpringBootConfiguration
public class FtpJavaApplication {
private static final Logger LOG = Logger.getLogger(FtpJavaApplication.class);
public static void main(String[] args) {
LOG.info("1");
new SpringApplicationBuilder(FtpJavaApplication.class)
.web(false)
.run(args);
}
@Bean
public SessionFactory<FTPFile> ftpSessionFactory() {
LOG.info("2");
DefaultFtpSessionFactory sf = new DefaultFtpSessionFactory();
sf.setHost("host");
sf.setPort(port);
sf.setUsername("userid");
sf.setPassword("password");
return new CachingSessionFactory<FTPFile>(sf);
}
@Bean
public FtpInboundFileSynchronizer ftpInboundFileSynchronizer() {
LOG.info("3");
Session<FTPFile> session = ftpSessionFactory().getSession();
try {
System.out.println(3.1);
String[] listNames = session.listNames(".");
System.out.println(3.2);
System.out.println(Arrays.toString(listNames));
System.out.println(3.3);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
FtpInboundFileSynchronizer fileSynchronizer = new FtpInboundFileSynchronizer(ftpSessionFactory());
fileSynchronizer.setDeleteRemoteFiles(false);
fileSynchronizer.setRemoteDirectory(".");
fileSynchronizer.setFilter(new FtpSimplePatternFileListFilter("*"));
return fileSynchronizer;
}
@Bean
@InboundChannelAdapter(channel = "ftpChannel", poller = @Poller(fixedDelay = "5000"))
public MessageSource<File> ftpMessageSource() {
LOG.info("4");
FtpInboundFileSynchronizingMessageSource source =
new FtpInboundFileSynchronizingMessageSource(ftpInboundFileSynchronizer());
source.setLocalDirectory(new File("c:/temp/ftp"));
source.setAutoCreateLocalDirectory(true);
source.setLocalFilter(new AcceptOnceFileListFilter<File>());
return source;
}
@Bean
@ServiceActivator(inputChannel = "ftpChannel")
public MessageHandler handler() {
LOG.info("5");
return new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessagingException {
System.out.println(message.getPayload());
}
};
}
}
如果使用 ftpSession 对象,我可以列出远程目录中的所有文件。但是同步不起作用,文件没有 FTP 到本地目录。应用程序在日志中没有报告错误。
[2016-12-22 09:57:43, 314]DEBUG[main] (SpringApplication.java:689) - Loading source class FtpJavaApplication
[2016-12-22 09:57:43, 466]DEBUG[main] (ClassPathScanningCandidateComponentProvider.java:252) - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
[2016-12-22 09:57:43, 480]INFO [main] (AbstractApplicationContext.java:581) - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@166ebe0: startup date [Thu Dec 22 09:57:43 EST 2016]; root of context hierarchy
[2016-12-22 09:57:43, 480]DEBUG[main] (AbstractApplicationContext.java:615) - Bean factory for org.springframework.context.annotation.AnnotationConfigApplicationContext@166ebe0: org.springframework.beans.factory.support.DefaultListableBeanFactory@55dd0c: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,ftpJavaApplication]; root of factory hierarchy
[2016-12-22 09:57:43, 491]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[2016-12-22 09:57:43, 491]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[2016-12-22 09:57:43, 495]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 496]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[2016-12-22 09:57:43, 518]DEBUG[main] (ConfigurationClassBeanDefinitionReader.java:256) - Registering bean definition for @Bean method FtpJavaApplication.ftpSessionFactory()
[2016-12-22 09:57:43, 519]DEBUG[main] (ConfigurationClassBeanDefinitionReader.java:256) - Registering bean definition for @Bean method FtpJavaApplication.ftpMessageSource()
[2016-12-22 09:57:43, 519]DEBUG[main] (ConfigurationClassBeanDefinitionReader.java:256) - Registering bean definition for @Bean method FtpJavaApplication.handler()
[2016-12-22 09:57:43, 520]DEBUG[main] (ConfigurationClassBeanDefinitionReader.java:256) - Registering bean definition for @Bean method FtpJavaApplication.ftpInboundFileSynchronizer()
[2016-12-22 09:57:43, 581]DEBUG[main] (ConfigurationClassEnhancer.java:109) - Successfully enhanced FtpJavaApplication; enhanced class name is: FtpJavaApplication$$EnhancerBySpringCGLIB$$a6fc584e
[2016-12-22 09:57:43, 582]DEBUG[main] (ConfigurationClassPostProcessor.java:409) - Replacing bean definition 'ftpJavaApplication' existing class 'FtpJavaApplication' with enhanced class 'FtpJavaApplication$$EnhancerBySpringCGLIB$$a6fc584e'
[2016-12-22 09:57:43, 582]DEBUG[main] (MutablePropertySources.java:159) - Removing [applicationConfigurationProperties] PropertySource
[2016-12-22 09:57:43, 582]DEBUG[main] (MutablePropertySources.java:159) - Removing [defaultProperties] PropertySource
[2016-12-22 09:57:43, 584]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[2016-12-22 09:57:43, 584]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[2016-12-22 09:57:43, 585]INFO [main] (AutowiredAnnotationBeanPostProcessor.java:155) - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[2016-12-22 09:57:43, 585]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 585]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[2016-12-22 09:57:43, 585]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
[2016-12-22 09:57:43, 585]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
[2016-12-22 09:57:43, 586]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 586]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
[2016-12-22 09:57:43, 586]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[2016-12-22 09:57:43, 586]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[2016-12-22 09:57:43, 589]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
[2016-12-22 09:57:43, 590]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
[2016-12-22 09:57:43, 590]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
[2016-12-22 09:57:43, 590]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 590]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
[2016-12-22 09:57:43, 592]DEBUG[main] (AbstractApplicationContext.java:728) - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@13bda92]
[2016-12-22 09:57:43, 592]DEBUG[main] (AbstractApplicationContext.java:752) - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@4bb45b]
[2016-12-22 09:57:43, 593]DEBUG[main] (DefaultListableBeanFactory.java:744) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@55dd0c: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,ftpJavaApplication,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,ftpSessionFactory,ftpMessageSource,handler,ftpInboundFileSynchronizer]; root of factory hierarchy
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.event.internalEventListenerProcessor'
[2016-12-22 09:57:43, 597]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.event.internalEventListenerProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 600]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.event.internalEventListenerProcessor'
[2016-12-22 09:57:43, 600]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory'
[2016-12-22 09:57:43, 600]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.event.internalEventListenerFactory'
[2016-12-22 09:57:43, 600]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.event.internalEventListenerFactory' to allow for resolving potential circular references
[2016-12-22 09:57:43, 602]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.event.internalEventListenerFactory'
[2016-12-22 09:57:43, 602]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 602]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 603]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'ftpJavaApplication' to allow for resolving potential circular references
[2016-12-22 09:57:43, 605]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 605]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
[2016-12-22 09:57:43, 606]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
[2016-12-22 09:57:43, 606]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'ftpSessionFactory'
[2016-12-22 09:57:43, 606]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'ftpSessionFactory'
[2016-12-22 09:57:43, 608]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 621]INFO [main] (FtpJavaApplication.java:39) - 2
[2016-12-22 09:57:43, 625]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'ftpSessionFactory' to allow for resolving potential circular references
[2016-12-22 09:57:43, 627]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'ftpSessionFactory'
[2016-12-22 09:57:43, 627]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'ftpMessageSource'
[2016-12-22 09:57:43, 627]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'ftpMessageSource'
[2016-12-22 09:57:43, 627]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 628]INFO [main] (FtpJavaApplication.java:73) - 4
[2016-12-22 09:57:43, 631]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'ftpInboundFileSynchronizer'
[2016-12-22 09:57:43, 631]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'ftpInboundFileSynchronizer'
[2016-12-22 09:57:43, 631]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 631]INFO [main] (FtpJavaApplication.java:50) - 3
[2016-12-22 09:57:43, 631]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpSessionFactory'
[2016-12-22 09:57:43, 651]DEBUG[main] (AbstractFtpSessionFactory.java:197) - Connected to server [abcd:21]
[2016-12-22 09:57:44, 845]DEBUG[main] (SimplePool.java:190) - Obtained new org.springframework.integration.ftp.session.FtpSession@1c19a70.
3.1
3.2
[a.txt, b.txt, c.txt, d.txt]
3.3
[2016-12-22 10:01:08,204813]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpSessionFactory'
[2016-12-22 10:01:08,204842]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'ftpInboundFileSynchronizer' to allow for resolving potential circular references
[2016-12-22 10:01:08,204845]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:1620) - Invoking afterPropertiesSet() on bean with name 'ftpInboundFileSynchronizer'
[2016-12-22 10:01:08,204850]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'ftpInboundFileSynchronizer'
[2016-12-22 10:01:08,204855]DEBUG[main] (PathMatchingResourcePatternResolver.java:317) - Resolved classpath location [META-INF/spring.integration.default.properties] to resources [URL [jar:file:/C:/data/.m2/repository/org/springframework/integration/spring-integration-core/4.3.1.RELEASE/spring-integration-core-4.3.1.RELEASE.jar!/META-INF/spring.integration.default.properties]]
[2016-12-22 10:01:08,204857]INFO [main] (PropertiesLoaderSupport.java:172) - Loading properties file from URL [jar:file:/C:/data/.m2/repository/org/springframework/integration/spring-integration-core/4.3.1.RELEASE/spring-integration-core-4.3.1.RELEASE.jar!/META-INF/spring.integration.default.properties]
[2016-12-22 10:01:08,204863]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'ftpMessageSource' to allow for resolving potential circular references
[2016-12-22 10:01:08,204871]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:1620) - Invoking afterPropertiesSet() on bean with name 'ftpMessageSource'
[2016-12-22 10:01:08,204872]DEBUG[main] (IntegrationUtils.java:79) - No MessageBuilderFactory with name 'messageBuilderFactory' found: No bean named 'messageBuilderFactory' is defined, using default.
[2016-12-22 10:01:08,204873]DEBUG[main] (IntegrationUtils.java:79) - No MessageBuilderFactory with name 'messageBuilderFactory' found: No bean named 'messageBuilderFactory' is defined, using default.
[2016-12-22 10:01:08,204873]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'ftpMessageSource'
[2016-12-22 10:01:08,204874]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'handler'
[2016-12-22 10:01:08,204874]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'handler'
[2016-12-22 10:01:08,204874]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpJavaApplication'
[2016-12-22 10:01:08,204874]INFO [main] (FtpJavaApplication.java:85) - 5
[2016-12-22 10:01:08,204875]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'handler' to allow for resolving potential circular references
[2016-12-22 10:01:08,204876]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'handler'
[2016-12-22 10:01:08,204876]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpInboundFileSynchronizer'
[2016-12-22 10:01:08,204877]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory'
[2016-12-22 10:01:08,204891]DEBUG[main] (AbstractApplicationContext.java:779) - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@b346ea]
[2016-12-22 10:01:08,204891]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpMessageSource'
[2016-12-22 10:01:08,204891]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'lifecycleProcessor'
[2016-12-22 10:01:08,204896]DEBUG[main] (PropertySourcesPropertyResolver.java:91) - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source
[2016-12-22 10:01:08,204898]INFO [main] (StartupInfoLogger.java:57) - Started FtpJavaApplication in 204.804 seconds (JVM running for 205.247)
您的注释有误:@SpringBootConfiguration
应该是 @SpringBootApplication
。
这将添加 @EnableIntegration
。
我正在尝试使用 FtpInboundFileSynchronizer 但无法修复它。它没有报告任何问题,也没有工作。我指的是代码 http://docs.spring.io/spring-integration/reference/html/ftp.html#_configuring_with_java_configuration_10
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.log4j.Logger;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.file.filters.AcceptOnceFileListFilter;
import org.springframework.integration.file.remote.session.CachingSessionFactory;
import org.springframework.integration.file.remote.session.Session;
import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.ftp.filters.FtpSimplePatternFileListFilter;
import org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizer;
import org.springframework.integration.ftp.inbound.FtpInboundFileSynchronizingMessageSource;
import org.springframework.integration.ftp.session.DefaultFtpSessionFactory;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
@SpringBootConfiguration
public class FtpJavaApplication {
private static final Logger LOG = Logger.getLogger(FtpJavaApplication.class);
public static void main(String[] args) {
LOG.info("1");
new SpringApplicationBuilder(FtpJavaApplication.class)
.web(false)
.run(args);
}
@Bean
public SessionFactory<FTPFile> ftpSessionFactory() {
LOG.info("2");
DefaultFtpSessionFactory sf = new DefaultFtpSessionFactory();
sf.setHost("host");
sf.setPort(port);
sf.setUsername("userid");
sf.setPassword("password");
return new CachingSessionFactory<FTPFile>(sf);
}
@Bean
public FtpInboundFileSynchronizer ftpInboundFileSynchronizer() {
LOG.info("3");
Session<FTPFile> session = ftpSessionFactory().getSession();
try {
System.out.println(3.1);
String[] listNames = session.listNames(".");
System.out.println(3.2);
System.out.println(Arrays.toString(listNames));
System.out.println(3.3);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
FtpInboundFileSynchronizer fileSynchronizer = new FtpInboundFileSynchronizer(ftpSessionFactory());
fileSynchronizer.setDeleteRemoteFiles(false);
fileSynchronizer.setRemoteDirectory(".");
fileSynchronizer.setFilter(new FtpSimplePatternFileListFilter("*"));
return fileSynchronizer;
}
@Bean
@InboundChannelAdapter(channel = "ftpChannel", poller = @Poller(fixedDelay = "5000"))
public MessageSource<File> ftpMessageSource() {
LOG.info("4");
FtpInboundFileSynchronizingMessageSource source =
new FtpInboundFileSynchronizingMessageSource(ftpInboundFileSynchronizer());
source.setLocalDirectory(new File("c:/temp/ftp"));
source.setAutoCreateLocalDirectory(true);
source.setLocalFilter(new AcceptOnceFileListFilter<File>());
return source;
}
@Bean
@ServiceActivator(inputChannel = "ftpChannel")
public MessageHandler handler() {
LOG.info("5");
return new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessagingException {
System.out.println(message.getPayload());
}
};
}
}
如果使用 ftpSession 对象,我可以列出远程目录中的所有文件。但是同步不起作用,文件没有 FTP 到本地目录。应用程序在日志中没有报告错误。
[2016-12-22 09:57:43, 314]DEBUG[main] (SpringApplication.java:689) - Loading source class FtpJavaApplication
[2016-12-22 09:57:43, 466]DEBUG[main] (ClassPathScanningCandidateComponentProvider.java:252) - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
[2016-12-22 09:57:43, 480]INFO [main] (AbstractApplicationContext.java:581) - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@166ebe0: startup date [Thu Dec 22 09:57:43 EST 2016]; root of context hierarchy
[2016-12-22 09:57:43, 480]DEBUG[main] (AbstractApplicationContext.java:615) - Bean factory for org.springframework.context.annotation.AnnotationConfigApplicationContext@166ebe0: org.springframework.beans.factory.support.DefaultListableBeanFactory@55dd0c: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,ftpJavaApplication]; root of factory hierarchy
[2016-12-22 09:57:43, 491]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[2016-12-22 09:57:43, 491]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[2016-12-22 09:57:43, 495]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 496]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[2016-12-22 09:57:43, 518]DEBUG[main] (ConfigurationClassBeanDefinitionReader.java:256) - Registering bean definition for @Bean method FtpJavaApplication.ftpSessionFactory()
[2016-12-22 09:57:43, 519]DEBUG[main] (ConfigurationClassBeanDefinitionReader.java:256) - Registering bean definition for @Bean method FtpJavaApplication.ftpMessageSource()
[2016-12-22 09:57:43, 519]DEBUG[main] (ConfigurationClassBeanDefinitionReader.java:256) - Registering bean definition for @Bean method FtpJavaApplication.handler()
[2016-12-22 09:57:43, 520]DEBUG[main] (ConfigurationClassBeanDefinitionReader.java:256) - Registering bean definition for @Bean method FtpJavaApplication.ftpInboundFileSynchronizer()
[2016-12-22 09:57:43, 581]DEBUG[main] (ConfigurationClassEnhancer.java:109) - Successfully enhanced FtpJavaApplication; enhanced class name is: FtpJavaApplication$$EnhancerBySpringCGLIB$$a6fc584e
[2016-12-22 09:57:43, 582]DEBUG[main] (ConfigurationClassPostProcessor.java:409) - Replacing bean definition 'ftpJavaApplication' existing class 'FtpJavaApplication' with enhanced class 'FtpJavaApplication$$EnhancerBySpringCGLIB$$a6fc584e'
[2016-12-22 09:57:43, 582]DEBUG[main] (MutablePropertySources.java:159) - Removing [applicationConfigurationProperties] PropertySource
[2016-12-22 09:57:43, 582]DEBUG[main] (MutablePropertySources.java:159) - Removing [defaultProperties] PropertySource
[2016-12-22 09:57:43, 584]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[2016-12-22 09:57:43, 584]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[2016-12-22 09:57:43, 585]INFO [main] (AutowiredAnnotationBeanPostProcessor.java:155) - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[2016-12-22 09:57:43, 585]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 585]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[2016-12-22 09:57:43, 585]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
[2016-12-22 09:57:43, 585]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
[2016-12-22 09:57:43, 586]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 586]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
[2016-12-22 09:57:43, 586]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[2016-12-22 09:57:43, 586]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[2016-12-22 09:57:43, 589]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 589]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
[2016-12-22 09:57:43, 590]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
[2016-12-22 09:57:43, 590]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
[2016-12-22 09:57:43, 590]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 590]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
[2016-12-22 09:57:43, 592]DEBUG[main] (AbstractApplicationContext.java:728) - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@13bda92]
[2016-12-22 09:57:43, 592]DEBUG[main] (AbstractApplicationContext.java:752) - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@4bb45b]
[2016-12-22 09:57:43, 593]DEBUG[main] (DefaultListableBeanFactory.java:744) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@55dd0c: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,ftpJavaApplication,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,ftpSessionFactory,ftpMessageSource,handler,ftpInboundFileSynchronizer]; root of factory hierarchy
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerProcessor'
[2016-12-22 09:57:43, 593]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.event.internalEventListenerProcessor'
[2016-12-22 09:57:43, 597]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.event.internalEventListenerProcessor' to allow for resolving potential circular references
[2016-12-22 09:57:43, 600]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.event.internalEventListenerProcessor'
[2016-12-22 09:57:43, 600]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory'
[2016-12-22 09:57:43, 600]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.springframework.context.event.internalEventListenerFactory'
[2016-12-22 09:57:43, 600]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'org.springframework.context.event.internalEventListenerFactory' to allow for resolving potential circular references
[2016-12-22 09:57:43, 602]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.springframework.context.event.internalEventListenerFactory'
[2016-12-22 09:57:43, 602]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 602]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 603]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'ftpJavaApplication' to allow for resolving potential circular references
[2016-12-22 09:57:43, 605]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 605]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
[2016-12-22 09:57:43, 606]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
[2016-12-22 09:57:43, 606]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'ftpSessionFactory'
[2016-12-22 09:57:43, 606]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'ftpSessionFactory'
[2016-12-22 09:57:43, 608]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 621]INFO [main] (FtpJavaApplication.java:39) - 2
[2016-12-22 09:57:43, 625]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'ftpSessionFactory' to allow for resolving potential circular references
[2016-12-22 09:57:43, 627]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'ftpSessionFactory'
[2016-12-22 09:57:43, 627]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'ftpMessageSource'
[2016-12-22 09:57:43, 627]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'ftpMessageSource'
[2016-12-22 09:57:43, 627]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 628]INFO [main] (FtpJavaApplication.java:73) - 4
[2016-12-22 09:57:43, 631]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'ftpInboundFileSynchronizer'
[2016-12-22 09:57:43, 631]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'ftpInboundFileSynchronizer'
[2016-12-22 09:57:43, 631]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpJavaApplication'
[2016-12-22 09:57:43, 631]INFO [main] (FtpJavaApplication.java:50) - 3
[2016-12-22 09:57:43, 631]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpSessionFactory'
[2016-12-22 09:57:43, 651]DEBUG[main] (AbstractFtpSessionFactory.java:197) - Connected to server [abcd:21]
[2016-12-22 09:57:44, 845]DEBUG[main] (SimplePool.java:190) - Obtained new org.springframework.integration.ftp.session.FtpSession@1c19a70.
3.1
3.2
[a.txt, b.txt, c.txt, d.txt]
3.3
[2016-12-22 10:01:08,204813]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpSessionFactory'
[2016-12-22 10:01:08,204842]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'ftpInboundFileSynchronizer' to allow for resolving potential circular references
[2016-12-22 10:01:08,204845]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:1620) - Invoking afterPropertiesSet() on bean with name 'ftpInboundFileSynchronizer'
[2016-12-22 10:01:08,204850]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'ftpInboundFileSynchronizer'
[2016-12-22 10:01:08,204855]DEBUG[main] (PathMatchingResourcePatternResolver.java:317) - Resolved classpath location [META-INF/spring.integration.default.properties] to resources [URL [jar:file:/C:/data/.m2/repository/org/springframework/integration/spring-integration-core/4.3.1.RELEASE/spring-integration-core-4.3.1.RELEASE.jar!/META-INF/spring.integration.default.properties]]
[2016-12-22 10:01:08,204857]INFO [main] (PropertiesLoaderSupport.java:172) - Loading properties file from URL [jar:file:/C:/data/.m2/repository/org/springframework/integration/spring-integration-core/4.3.1.RELEASE/spring-integration-core-4.3.1.RELEASE.jar!/META-INF/spring.integration.default.properties]
[2016-12-22 10:01:08,204863]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'ftpMessageSource' to allow for resolving potential circular references
[2016-12-22 10:01:08,204871]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:1620) - Invoking afterPropertiesSet() on bean with name 'ftpMessageSource'
[2016-12-22 10:01:08,204872]DEBUG[main] (IntegrationUtils.java:79) - No MessageBuilderFactory with name 'messageBuilderFactory' found: No bean named 'messageBuilderFactory' is defined, using default.
[2016-12-22 10:01:08,204873]DEBUG[main] (IntegrationUtils.java:79) - No MessageBuilderFactory with name 'messageBuilderFactory' found: No bean named 'messageBuilderFactory' is defined, using default.
[2016-12-22 10:01:08,204873]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'ftpMessageSource'
[2016-12-22 10:01:08,204874]DEBUG[main] (DefaultSingletonBeanRegistry.java:221) - Creating shared instance of singleton bean 'handler'
[2016-12-22 10:01:08,204874]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'handler'
[2016-12-22 10:01:08,204874]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpJavaApplication'
[2016-12-22 10:01:08,204874]INFO [main] (FtpJavaApplication.java:85) - 5
[2016-12-22 10:01:08,204875]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:529) - Eagerly caching bean 'handler' to allow for resolving potential circular references
[2016-12-22 10:01:08,204876]DEBUG[main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'handler'
[2016-12-22 10:01:08,204876]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpInboundFileSynchronizer'
[2016-12-22 10:01:08,204877]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory'
[2016-12-22 10:01:08,204891]DEBUG[main] (AbstractApplicationContext.java:779) - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@b346ea]
[2016-12-22 10:01:08,204891]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'ftpMessageSource'
[2016-12-22 10:01:08,204891]DEBUG[main] (AbstractBeanFactory.java:251) - Returning cached instance of singleton bean 'lifecycleProcessor'
[2016-12-22 10:01:08,204896]DEBUG[main] (PropertySourcesPropertyResolver.java:91) - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source
[2016-12-22 10:01:08,204898]INFO [main] (StartupInfoLogger.java:57) - Started FtpJavaApplication in 204.804 seconds (JVM running for 205.247)
您的注释有误:@SpringBootConfiguration
应该是 @SpringBootApplication
。
这将添加 @EnableIntegration
。