Hello,
Background: I'm running Camel 2.12 and Spring 4.0.2.
I'm trying to define my Spring ApplicationContext via an
AnnotationConfigApplicationContext, which defines a bean with an @Consume
annotation on one of it's methods. Unfortunately Camel never seems to find
my annotated method - I never see CamelPostProcessorHelper log that it is
creating a consumer based on the annotation.
If I switch over to a ClasspathXmlApplicationContext it picks up the
annotation just fine and everything works.
Is this a known limitation? Or is there anything special I need to be aware
of with the AnnotationConfigApplicationContext?
Here's brief code (please excuse the lack of imports or potential obvious
syntax issues - I am having to retype this by hand):
Main.class:
public class Main {
public static void main(String [] args) {
ApplicationContext ctx = new
AnnotationConfigApplicationContext(Config.class);
}
}
Config.class:
@Configuration
public class Config {
@Bean
public Data getData() {
return new Data();
}
@Bean
public SpringCamelContext getSpringCamelContext(ApplicationContext ctx) {
// note: If I do a ctx.getBean(Data.class) here, I will get back a Data
object correctly
return new SpringCamelContext(ctx);
}
}
Data.class:
public class Data {
@Consume(uri="file:/tmp/asdf")
public void consumeData(String body) {
System.out.println(body);
}
}
--
View this message in context:
http://camel.465427.n5.nabble.com/Using-Consume-with-Springs-AnnotationConfigApplicationContext-tp5751435.html
Sent from the Camel - Users mailing list archive at Nabble.com.