我在一個帶有春天駱駝上下文,一個路由和一個測試的小項目上使用Fuse IDE(Eclipse)。我爲定義測試執行環境增加了一個額外的xml。加載春天駱駝上下文時出錯(類型不匹配)
當我運行測試時,它加載上下文bean信息時發生類型不匹配(當實例化bean上下文的PropertyDescriptor類時,setter類型爲org.apache.camel.spring.SpringCamelContext,getter類型爲org.apache。 camel.model.ModelCamelContext ...
原來的例外是: 「java.beans.IntrospectionException:讀之間和write方法類型不匹配」
測試代碼是這樣的:
public class TestDBRoute extends CamelSpringTestSupport {
@DirtiesContext //reload context
@Test
public void testPoll() throws Exception {
//context.start();
System.out.println("comenzo");
Thread.sleep(1000);
System.out.println("termino");
//context.stop();
assertEquals("first", 1, 1);
}
@Override
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("classpath:/com/test-camel-context.xml");
}
}
的駱駝上下文代碼是:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<packageScan>
<package>com.test.fuse.routes</package>
</packageScan>
</camelContext>
</beans>
路由代碼爲空,它只擴展RouteBuilder並覆蓋configure方法。
我在Ubuntu上使用OpenJDK 1.6.0_24。
如果您需要其他的東西,請詢問。
感謝