I have a Spring Boot application with camel routes that starts up and runs
fine in Tomcat (it is a web app). However I am having real issues getting it
to run as a unit test. I have an @Configuration file that has 3 RouteBuilder
beans. I do not explicitly define a CamelContext been and instead let
camel-spring-boot do that for me (works when deployed).

However, when I try to use this as part of a unit test the route does not
get started up and if I try to @Autowire the CamelContext I get a no such
bean exception.

Here is my test 

@RunWith(SpringJUnit4ClassRunner.class)
@BootstrapWith(CamelTestContextBootstrapper.class)
@SpringApplicationConfiguration(classes={MyConfiguration.class})
@EnableAutoConfiguration
public class MyTest{

@Autowired
public CamelContext context;

@Producer(uri="direct:blah")
public ProducerTemplate template;

@Test
public void mytest(){
template.sendBody("blah");
}

I have another project where I explicitly created the CamelContext in a
spring XML file and that worked really well but would like to avoid that
since I don't need it with Spring Boot.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Spring-Boot-startup-not-working-in-JUnit-tp5801391.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to