Reputation: 54810
I have a camel route file which I want to populate/configure based on certain database records accessed through Grails domain classes. However, I cannot seem to access the domain classes (or anything in the spring context) from MyRoute.groovy. Any ideas on how I can make that possible?
I tried the recommendations at Grails: Accessing spring beans in the destory closure of Bootstrap code? but that doesn't seem to work.
Upvotes: 3
Views: 2379
Reputation: 5147
You should take look at: http://camel.apache.org/hibernate.html
Please note, that you should add:
...
ref('sessionFactory')
...
to beans
section in your resources.groovy
Upvotes: 0
Reputation: 55555
In the Java RouteBuilder you can get hold of the CamelContext with the getContext() method. I assume you have the same method in the groovy builder.
With the CamelContext you can lookup spring beans from its registry.
MyType foo = context.getRegistry().lookup("mySpringBean", MyType.class);
Upvotes: 3