元素'int-xml:xpath-filter'没有声明

时间:2016-11-03 19:48:33

标签: spring spring-integration

在IDEA中运行时,我知道为什么会出现此错误?我已经尝试了已经回答的建议问题。

xml命名空间和schemalocation根据文档匹配。

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

<int-file:inbound-channel-adapter
        id="fileIn"
        directory="file:${java.io.tmpdir}/fileFilter/input">
    <int:poller fixed-delay="500" />
</int-file:inbound-channel-adapter>

<int:service-activator input-channel="fileIn" output-channel="fiterInChannel" ref="handler"/>
<bean id="handler" class="org.learning.springintegration.fileadapters.FileInOutDemo"/>

<int:channel id="fiterInChannel">
</int:channel>

<int-xml:xpath-filter id="fileMajorAlarmFilter"
                      input-channel="fiterInChannel"
                      match-type="exact"
                      match-value="3"
                      output-channel="fileOut"
                      throw-exception-on-rejection="false">
    <int-xml:xpath-expression expression="/alarm/priorityvalue/text()" />
</int-xml:xpath-filter>

<int-file:outbound-channel-adapter
        id="fileOut"
        directory="file:${java.io.tmpdir}/fileFilter/output"
        delete-source-files="true"/>

1 个答案:

答案 0 :(得分:1)

修正:

添加了依赖

<dependency>
  <groupId>org.springframework.integration</groupId>
  <artifactId>spring-integration-xml</artifactId>
  <version>4.3.1.RELEASE</version>
  <scope>compile</scope>
</dependency>