Skip to content

Instantly share code, notes, and snippets.

@uarun
Created November 25, 2011 23:49
Show Gist options
  • Save uarun/1394695 to your computer and use it in GitHub Desktop.
Save uarun/1394695 to your computer and use it in GitHub Desktop.
BeanBuilder definition to scan (spring) container context for Camel Routes
import org.apache.camel.CamelContext
import org.apache.camel.processor.interceptor.DefaultTraceFormatter
import org.apache.camel.processor.interceptor.Tracer
beans {
def config = application.config
xmlns camel: "http://camel.apache.org/schema/spring"
xmlns context: "http://www.springframework.org/schema/context"
camelTracer(Tracer) {
traceOutExchanges = true
logLevel = 'INFO'
}
traceFormatter(DefaultTraceFormatter) {
breadCrumbLength = 0
nodeLength = 0
showBreadCrumb = true
showNode = true
showProperties = true
showHeaders = true
showExchangePattern = true
showException = true
showBody = true
showBodyType = true
}
//... This will enable Spring to pickup classes with @Component annotation
context.'component-scan'('base-package': 'com.arun.routes')
//... The above could also be done by setting - grails.spring.bean.packages = ['...']
//... But we like this better since its nicely externalized
camel.camelContext(id: 'camelContext') {
camel.contextScan {} //... Camel now scans the context for Routebuilder instances
}
}
beans = {
importBeans 'file:conf/spring/camel-beans.groovy'
}
Copy link

ghost commented Aug 22, 2016

I think we need to specify "package spring" in camel-beans.groovy to run it, Please correct me if I am wrong, I faced this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment