我试图在Spring中配置一个RabbitMQ集群,因此我遵循Spring (http://docs.spring.io/spring-amqp/reference/html/amqp.html),但添加地址时出错:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/rabbit
http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd">
<rabbit:connection-factory id="connectionFactory" addresses="host1,host2" />我在gradle中定义的依赖项:
compile group: 'org.springframework.amqp', name: 'spring-amqp', version:'1.2.0.RELEASE'
compile group: 'org.springframework.amqp', name: 'spring-rabbit', version:'1.2.0.RELEASE'有人知道为什么会这样吗?谢谢!
编辑:我得到的错误是:cvc-复合- The .3.2.2:属性‘地址’不允许出现在元素‘兔子:连接-工厂’。host1和host2是虚拟机的IP。
发布于 2013-11-25 15:19:52
这是因为您在schemaLocation中为1.0版本声明了Spring-兔子XSD文件。只要改变:
http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
至
http://www.springframework.org/schema/rabbit/spring-rabbit-1.2.xsd
与你的春兔版相匹配,而且应该能用。
https://stackoverflow.com/questions/20195850
复制相似问题