更新时间:2022-01-08 01:06:50
尝试使用CamelSpringBootRunner.class
作为运行器,并在测试中添加@SpringBootTest
注解类.
Try to use the CamelSpringBootRunner.class
as the runner and add the @SpringBootTest
annotation to the test class.
示例来自 Camel 存储库
Example from the Camel repository
如果您将引导程序类更改为 SpringBootTestContextBootstrapper
那么它应该可以工作:
If you change your bootstrapper class to SpringBootTestContextBootstrapper
then it should work:
@BootstrapWith(SpringBootTestContextBootstrapper.class)
您拥有的等效配置,但在这种情况下您不需要添加 ContextConfiguration
和 BootstrapWith
注释:
@RunWith(CamelSpringBootRunner.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@MockEndpoints("log:*")
@DisableJmx(false)
@SpringBootTest(classes = MyClass.class)