【问题标题】:Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/integration/ip无法找到 XML 模式命名空间的 Spring NamespaceHandler [http://www.springframework.org/schema/integration/ip
【发布时间】:2017-10-05 14:55:19
【问题描述】:

嗨,你能帮我一下吗?我在 Spring STS IDE 中使用 Spring 4.3.8。我得到这个异常:org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:找不到 XML 模式命名空间的 Spring NamespaceHandler [http://www.springframework.org/schema/integration/ip] 违规资源:类路径资源[spring-config.xml]

Maven 配置:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-integration</artifactId>
</dependency>

我的 Spring 配置是:

<?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-ip="http://www.springframework.org/schema/integration/ip"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
    http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd">

<context:property-placeholder location="classpath:udp-server.properties" />

<bean id="udpConsumer" class="com.example.udp.UDPConsumer" />

<int:channel id="inputChannel">
    <int:queue />
</int:channel>

<int-ip:udp-inbound-channel-adapter id="udpReceiver"
    channel="inputChannel"
    port="${udp-server.port}"
    pool-size="${udp-server.threads}"
    receive-buffer-size="${udp-server.buffer-size}"
    multicast="false"
    check-length="true"/>

<int:service-activator input-channel="inputChannel"
    ref="udpConsumer" />

<int:poller default="true" fixed-rate="500" />

【问题讨论】:

    标签: java spring spring-integration


    【解决方案1】:

    集成启动器仅引入spring-integration-core jar,以避免您不需要的jar 的类路径膨胀;你需要添加

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-ip</artifactId>
    </dependency>
    

    Boot/Maven 将引入正确的版本以匹配核心。

    【讨论】:

      猜你喜欢
      • 2015-02-25
      • 2013-10-04
      • 2019-01-27
      • 1970-01-01
      • 2011-01-10
      • 2018-05-16
      相关资源
      最近更新 更多