【发布时间】:2018-09-28 06:02:53
【问题描述】:
我在一个小项目中使用 Fuse IDE (Eclipse),它有一个 spring camel 上下文、一个路由和一个测试。我放了一个额外的xml来定义测试执行环境。
当我运行测试时,由于类型不匹配加载上下文 bean 信息而失败(当实例化 bean 上下文的 PropertyDescriptor 类时,setter 类型是 org.apache.camel.spring.SpringCamelContext 并且 getter 类型是 org.apache.camel .model.ModelCamelContext...
原来的异常是:“java.beans.IntrospectionException: type mismatch between read and write methods”
测试代码是这样的:
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。
如果您需要其他东西,请询问。
谢谢
【问题讨论】:
标签: java spring apache-camel apache-servicemix