gpt4 book ai didi

java - 无法找到 XML 模式命名空间的 Spring NamespaceHandler [http ://www. springframework.org/schema/integration/ip

转载 作者:行者123 更新时间:2023-11-30 06:44:55 25 4
gpt4 key购买 nike

嗨,你能帮我一下吗?我在 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" />

最佳答案

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

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

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

关于java - 无法找到 XML 模式命名空间的 Spring NamespaceHandler [http ://www. springframework.org/schema/integration/ip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43833512/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com