使用Java DSL从文件轮询-添加文件时出现编译错误。inboundAdapter

使用Java DSL从文件轮询-添加文件时出现编译错误。inboundAdapter,java,spring,spring-integration,Java,Spring,Spring Integration,我正在使用Spring集成JavaDSLV。1.2.2下面是一些示例,我尝试编写一个代码来轮询文件夹 return IntegrationFlows .from(Files.inboundAdapter(new File("/tmp/foo"))) .handle((p, h) -> fileProcessor.process(p)) .get(); 无法编译此代码,因为 "Cannot resolve me

我正在使用Spring集成JavaDSLV。1.2.2下面是一些示例,我尝试编写一个代码来轮询文件夹

    return IntegrationFlows
            .from(Files.inboundAdapter(new File("/tmp/foo")))
            .handle((p, h) -> fileProcessor.process(p))
            .get();
无法编译此代码,因为

"Cannot resolve method 'from(org.springframework.integration.dsl.
   file.FileInboundChannelAdapterSpec)'"

如何修复此问题以及如何添加固定间隔轮询?

不清楚IDE中发生了什么,但我们在测试用例中提供了此示例:

@Bean
public IntegrationFlow fileToFile() {
    return IntegrationFlows.from(Files.inboundAdapter(new File("/tmp/in"))
                    .autoCreateDirectory(true)
                    .patternFilter("*.txt"),
            e -> e.poller(Pollers.fixedDelay(5000)))
            .transform(Transformers.fileToString())
            .transform("payload.replaceAll('\r\n', '\n')")
            .handle(Files.outboundAdapter("'/tmp/out'")
                    .autoCreateDirectory(true))
            .get();
}
fixedDelay()
是您关于
fixed interval
的第二个问题的答案


Artem,您能澄清我应该使用哪些依赖项吗?我现在必须使用compile(“org.springframework.boot:springbootstarterintegration:1.5.4.RELEASE”),并且必须使用directtypecats IntegrationFlows.from((MessageSourceSpec>)Files.inboundAdapter(directory)-现在仍然得到链接错误error:(105,38)java:无法访问org.springframework.integration.file.FileReadingMessageSource未找到。当涉及到在依赖项中添加DSL支持时,Spring集成文档似乎非常糟糕。它只建议添加编译(“org.springframework.integration:Spring集成核心:4.3.10.RELEASE”)这不包括DSL。您必须添加
Spring集成文件
。Spring集成中的每个模块都是独立的jar、依赖项工件