camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Marcus <steven.marcus+nab...@gmail.com>
Subject Re: Camel-boot autowiring issue
Date Wed, 07 Jan 2015 07:21:31 GMT
Hello,

Thanks for the sample project. I adapted it to experiment with
@EndpointInject and @Produces -- they appear to be broken with spring-boot?

The shouldInjectCamelContext() test fails with null for resultEndpoint --
and template is null too.
(Using recently updated camel-spring-boot SNAPSHOT.)

@BootstrapWith(CamelTestContextBootstrapper.class)
@Configuration
@ComponentScan
@EnableAutoConfiguration
@SpringApplicationConfiguration(classes = {CamelConfigurationTest.class,
MyCamelConfiguration.class})
@RunWith(CamelSpringJUnit4ClassRunner.class)
public class CamelConfigurationTest extends Assert {

    @Autowired
    CamelContext camelContext;

    @Value("${name}")
    String name;
    @Autowired
    private CamelConfigurationProperties configurationProperties;
    @Autowired
    private Environment env;

    @EndpointInject(uri = "mock:result")
    private MockEndpoint resultEndpoint;

    @Produce(uri = "direct:RoomSyncRouteTest")
    private ProducerTemplate template;

    @Test
    public void shouldInjectCamelContext() {
        assertNotNull("camelContext", camelContext);
        assertNotNull("configurationProperties", configurationProperties);
        assertNotNull("env", env);
        assertNotNull("name", name);
        assertNotNull("resultEndpoint", resultEndpoint);
        assertNotNull("template", template);
    }

    @Test
    public void shouldLoadRoute() {
        assertEquals(1, camelContext.getRoutes().size());
    }
}

Camel + spring boot looks like a great combo...

TIA!
Steven




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-boot-autowiring-issue-tp5758543p5761414.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message