Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

CamelSpringJUnit4ClassRunner with Spring Boot

$
0
0
I’m been trying to use Camel with
. Spring Boot,
. test Routes with “@RunWith(CamelSpringJUnit4ClassRunner.class)”
.with @Produce(uri = "direct:in")
private ProducerTemplate producerTemplate;
.and @EndpointInject(uri = "mock:out")
private MockEndpoint out;

I’m not an experienced Spring specialist (Spring Boot seems like endless
labyrinth to me, with all of its @ContextConfiguration annotations).

I’ve tested CamelSpringJUnit4ClassRunner using 2.14-SNAPSHOT version of
Camel. Is it supposed to work, or is there something not completed in Spring
4 support?

I wondered if anybody has working example code to share. It would be of lots
of help – waiting for release of 2.14, because we have decided to use Spring
Boot in our project – and hopefully Camel embedded.

My last effort:

@RunWith(CamelSpringJUnit4ClassRunner.class)
//@ContextConfiguration(classes = Application.class)
@ContextConfiguration(classes = {Application.class, MyRouteBuilder.class},
loader = SpringApplicationContextLoader.class)
public class TestinGcamel_2 {

@Autowired
ApplicationContext ctx;

@Autowired
CamelContext camelContext;

@Produce(uri = "direct:in")
private ProducerTemplate producerTemplate;

@EndpointInject(uri = "mock:out")
private MockEndpoint mockOut;

Viewing all articles
Browse latest Browse all 5648

Latest Images

Trending Articles



Latest Images