gpt4 book ai didi

java - 命名空间未绑定(bind)问题

转载 作者:行者123 更新时间:2023-12-01 14:55:39 29 4
gpt4 key购买 nike

我是 Spring Integration 和 XML 的新手。我创建了以下配置文件:

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

http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="com.springProject.app"/>
<int:channel id="input"/>
<int:channel id="output">
<int:queue capacity="10"/>
</int:channel>


<int:service-activator input-channel="input"
output-channel="output"
ref="messageHandler"/>
</beans>

但是 IDE 给出了错误,告诉我“命名空间‘int’未绑定(bind)”。有谁知道错误可能出在哪里?提前致谢!

最佳答案

当前集成 xmlns 绑定(bind)到前缀 si,请将其更改为 int。

<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="

注意第四行的变化

或者,您可以将所有以 int 为前缀的标记更改为 si,例如:

<si:channel id="input"/>
<si:channel id="output">
<si:queue capacity="10"/>
</si:channel>

关于java - 命名空间未绑定(bind)问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14335074/

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