camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burkard Stephan <>
Subject Route and route test in Spring Boot application
Date Thu, 06 Apr 2017 07:01:38 GMT

We are moving our Camel/ActiveMQ services from Karaf bundles with Spring 3 and XML-Config
to Spring-Boot with Spring 4 and Java -Config. 

I have built a very small prototype of such a Spring Boot application with a Camel route and
the corresponding route test. I would like to know if this is "state of the art" to build
Camel routes and tests in Spring Boot or if this example still could be simplified or contains
old concepts that could be replaced with a successor concept.

We use Spring Boot 1.4.2, Spring 4.3.4 and Camel 2.17.3

I followed and
to build the example.

Thanks a lot

**** Pom.xml dependencies ****
<!-- camel -->
<!-- test scope -->

**** Route class ****
package prototype;
public class Route extends SpringRouteBuilder {
    private CamelContext camelContext;

    public void configure() {

**** Route test class ****
package prototype;
@ContextConfiguration(classes = { RouteTest.TestConfig.class}, loader = CamelSpringDelegatingTestContextLoader.class)
public class RouteTest {
    protected CamelContext camelContext;

    @EndpointInject(uri = "mock:destination")
    protected MockEndpoint destination;

    @Produce(uri = "direct:route")
    protected ProducerTemplate producer;

    public void testContextStartup() throws Exception {
        destination.expectedBodiesReceived("test1", "test2");



    public static class TestConfig extends CamelConfiguration {
View raw message