Java 属性“fixed rate”不允许出现在元素“int:poller”中

Java 属性“fixed rate”不允许出现在元素“int:poller”中,java,xml,spring,Java,Xml,Spring,我无法在轮询器标记下添加属性fixed rate,给定属性“fixed rate”不允许出现在元素“int:poller”中。。 请参考下面的xml文件 <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns:int="http://www.springframework.org/schema/integration" xmlns:beans="http://www.springframework.org/sche

我无法在轮询器标记下添加属性fixed rate,给定属性“fixed rate”不允许出现在元素“int:poller”中。。 请参考下面的xml文件

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:int="http://www.springframework.org/schema/integration"
  xmlns:beans="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
             xsi:schemaLocation="http://www.springframework.org/schema/integration
             http://www.springframework.org/schema/integration/spring-integration.xsd
             http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans.xsd
             http://www.springframework.org/schema/integration/sftp
             http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">

    <int:channel id="fileTransferChannel"/>

    <int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
        <int:poller fixed-rate="500"/>
    </int:inbound-channel-adapter>

</beans:beans>
<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>
请帮忙

<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>
将代码更改为

<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>

这是因为模式不允许在该元素上使用固定速率属性。我猜你想要这个:

<int:inbound-channel-adapter .... >
    <int:poller >
        <int:interval-trigger fixed-rate=".." />
    </int:poller >
</int:inbound-channel-adapter>
<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>

我遇到了同样的问题,我可以这样解决:

<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>

我知道我迟到了,但我要为像我这样偶然发现这一点的人补充这一点。有时,这可能是由于一些简单的错误,比如不包括spring依赖项。我将应用程序移动到SpringBoot,并忘记包含以下两个依赖项,因此收到了此错误。如果直接在pom中使用而不使用spring集成的dependencyManagement BOM,则应在下面的依赖项中添加版本

<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-integration</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-file</artifactId>
        </dependency>

将标签替换为以下内容:

<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>
<int:poller>
    <int:interval-trigger interval="1000" fixed-rate="500"/>
</int:poller>

只需将此依赖项添加到pom.xml中,它就对我起了作用

<int:inbound-channel-adapter id="fileTransferChannelAdapter" auto-startup="true" ref="fileTransferCollector" method="poll" channel="fileTransferChannel">
    <int:poller fixed-rate="500">
    </int:poller>
</int:inbound-channel-adapter>
<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-jdbc</artifactId>
</dependency>

感谢您的建议,现在我可以允许固定费率,但另一个例外是http//www.springframework.org/schema/integration advice chain“我想您需要学习或其他一些详细文档。