小编Mit*_*tal的帖子

Spring Boot Camel 测试

我需要在 Spring Boot 应用程序中测试 Camel 路由。我有 Spring boot 主类,其中声明了所有必需的 bean。我正在使用 CamelSpringJUnit4ClassRunner.class。在 @ContextConfiguration 中添加了我的 Spring boot 主类,因为它包含所有配置。我没有单独的配置类。

我在我的测试类中自动装配了 CamelContext:

@Autowired
CamelContext camelContext;
Run Code Online (Sandbox Code Playgroud)

但是测试失败并显示错误:

引起:org.springframework.beans.factory.NoSuchBeanDefinitionException:

没有可用的“org.apache.camel.CamelContext”类型的合格 bean:预计至少有 1 个 bean 有资格作为自动装配候选。

依赖注解:{@org.springframework.beans.factory.annotation.Autowired(required=true)}

apache-camel spring-boot junit5 camel-test

4
推荐指数
1
解决办法
5977
查看次数

标签 统计

apache-camel ×1

camel-test ×1

junit5 ×1

spring-boot ×1