http://static.springsource.org/spring-amqp/docs/1.0.x/reference/html/提到了rabbit:
命名空间,但从未提到架构位置是什么。谷歌搜索(和命名约定)最终得到:
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
但是这个文件不存在。那么xsd在哪里呢?
http://static.springsource.org/spring-amqp/docs/1.0.x/reference/html/提到了rabbit:
命名空间,但从未提到架构位置是什么。谷歌搜索(和命名约定)最终得到:
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
但是这个文件不存在。那么xsd在哪里呢?
今天的 XML 模式位于:
http://www.springframework.org/schema/rabbit/spring-rabbit-1.3.xsd
http://www.springframework.org/schema/rabbit/spring-rabbit-1.4.xsd
http://www.springframework.org/schema/rabbit/spring-rabbit-1.5.xsd
选择任何你需要的!
As a temporary solution, I'm using this schema location to enable autocomplete. Otherwise it is located in the spring-rabbit jar (but the IDE does not detect it):
That is (from a comment from stacker):
I have the following at the top of my schema declaration:
<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/rabbit
https://raw.github.com/SpringSource/spring-amqp/master/spring-rabbit/src/main/resources/org/springframework/amqp/rabbit/config/spring-rabbit-1.0.xsd">
我确认Bozho 的解决方案。
所以基本上在我的模式声明的顶部,我有以下内容:
<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/rabbit
https://raw.github.com/SpringSource/spring-amqp/master/spring-rabbit/src/main/resources/org/springframework/amqp/rabbit/config/spring-rabbit-1.0.xsd">
找到一个带有 META-INF/spring.schemas 的 spring jar,它引用了 rabbit xsd。通过添加此 maven 依赖项在我的配置中解决了该问题
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-amqp</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
或者
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<version>1.1.1.RELEASE</version>
</dependency>
我知道这个问题比较老,我的回答在最初的问题时可能不会奏效,但如果有人在今天之后遇到这个问题......
春兔xsd目前位于:
http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
要使用它,您的类路径中必须有 spring-rabbit-1.0.0.RELEASE.jar。
它应该包含在 AMQP jar 中。根据这个线程,您应该使用快照版本而不是 RC1,然后您应该不会收到任何错误。