I have a very simple camel route that I want to run:
@Component
public class MyRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:start")
.log(LoggingLevel.INFO, "Hello World");
}
}
To do this I wrote a test
@SpringBootTest
@CamelSpringBootTest
@DisableJmx
@BootstrapWith(SpringBootTestContextBootstrapper.class)
public class MyRouteTest {
@Autowired
private ProducerTemplate producerTemplate;
@Test
void testRoute(){
producerTemplate.requestBody("direct:start", "test");
}
}
I get error:
Unsatisfied dependency expressed through field 'producerTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.camel.ProducerTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
I found something similar from here: Spring Boot Camel Testing
I tried @BootstrapWith and also @EnableAutoConfiguration but they don't seem to help either.