Spring を HiveMQ (MQTT ブローカー) プラグインに統合しようとしています。spring-context を読み込むことができ、Bean は実際にスキャンされ、@Autowire の代わりに @Inject を使用して自動配線できます。
このプラグイン内で Spring-Rabbit を使用しようとすると、Spring フレームワークは、私の spring-context.xml の xml を正しく処理できないと文句を言います。
原因: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: 一致するワイルドカードは厳密ですが、要素 'rabbit:connection-factory' の宣言が見つかりません。
春のコンテキストは次のとおりです。
<?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: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.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/rabbit
http://www.springframework.org/schema/rabbit/spring-rabbit.xsd'>
<context:component-scan base-package="com.acme"/>
<rabbit:connection-factory id="connectionFactory"
addresses='localhost'
username='username'
password='password'
virtual-host='vhost'/>
</beans>
次のようにコンテキストをロードします。
ClassLoader classLoader = this.getClass().getClassLoader();
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext();
ctx.setClassLoader(classLoader);
ctx.setConfigLocation("spring-context.xml");
ctx.refresh();
HiveMQ プラグインのコンテキストなしで通常どおりアプリケーションを起動すると、必要なものがすべて見つかります。
どこを探すべきかヒントはありますか?