All, I'm currently creating a camel-spring-boot project and would like to add some tests using @UseAdviceWith but am hitting a few issues. I couldn't find an example that fit that use case exactly, so I've played around with different things to no avail.
Specifically, I found that when I use @ContextConfiguration to specify my main Spring app config, my use of @BootstrapWith(CamelTestContextBootstrapper.class) is honored (i.e. I can step through it in a debugger during startup) and I can see @UseAdviceWith being used in CamelSpringTestContextLoader.handleCamelContextStartup(). However, when I @Autowire my CamelContext into my test class, Spring startup fails because it can't find my CamelContext Spring bean (even when I explicitly include a @Configuration that extends CamelConfiguration, which explicitly creates a CamelContext @Bean). I need a reference to my CamelContext so that I can start it once I'm done setting up my routeWith advice. One last thing: when I use @SpringApplicationConfiguration instead of @ContextConfiguration, Spring is able to find the CamelContext bean but it ignores my @BootstrapWith(CamelTestContextBootstrapper.class) & @UseAdviceWith and thus just starts up the CamelContext automatically rather than waiting for me to start it manually (after my routeWith advice). Any pointers on what I might be doing wrong would be great. In summary: Honoring @UseAdviceWith but no CamelContext Spring bean: @ContextConfiguration(classes = {ApplicationConfig.class}) @RunWith(CamelSpringJUnit4ClassRunner.class) @BootstrapWith(CamelTestContextBootstrapper.class) @UseAdviceWith @Slf4j public class MyTest { @Autowired CamelContext camelContext; @Test public void test() throws InterruptedException { log.info("Starting test..."); Thread.sleep(1000 * 60); } } Have a CamelContext Spring bean but NOT honoring @UseAdviceWith: @SpringApplicationConfiguration(classes = {ApplicationConfig.class}) @RunWith(CamelSpringJUnit4ClassRunner.class) @BootstrapWith(CamelTestContextBootstrapper.class) @UseAdviceWith @Slf4j public class MyTest { @Autowired CamelContext camelContext; @Test public void test() throws InterruptedException { log.info("Starting test..."); Thread.sleep(1000 * 60); } } Thanks! Jeff