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.
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);