camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Bennison <>
Subject RE: camel-spring-boot + @UseAdviceWith
Date Thu, 14 Apr 2016 09:16:45 GMT
Our problem looks similar to this one with @MockEndpoints raised back in 2015 against Camel

The reason given by Joakim Bjørnstad appears to explain what we are experiencing.

The last comment on is:-

"I still need to add support for Spring test annotations like @MockEndpoints"

So perhaps they never got done. I had problems with @MockEndpoints as well. I am also experiencing
strangeness with NotifyBuilder but that could be unrelated.
From: Jeff Segal <>
Sent: 12 April 2016 16:46
Subject: camel-spring-boot + @UseAdviceWith


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

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

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})
public class MyTest {

    CamelContext camelContext;

    public void test() throws InterruptedException {"Starting test...");
        Thread.sleep(1000 * 60);


Have a CamelContext Spring bean but NOT honoring @UseAdviceWith:

@SpringApplicationConfiguration(classes = {ApplicationConfig.class})
public class MyTest {

    CamelContext camelContext;

    public void test() throws InterruptedException {"Starting test...");
        Thread.sleep(1000 * 60);


This email is confidential and may be privileged. If you are not the intended recipient, please
notify the sender immediately and delete the email from your computer. You should not copy
the email, use it for any purpose or disclose its contents to any other person. Please note
that any views or opinions presented in this email may be personal to the author and do not
necessarily represent the views or opinions of MetaPack. It is the responsibility of the recipient
to check this email for the presence of viruses. MetaPack accepts no liability for any damage
caused by any virus transmitted by this email. MetaPack Registered Office: 4th Floor, 200
Gray’s Inn Road London WC1X 8XZ. Registered in England No. 03870530. VAT No 945 7723 86.
View raw message