Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Is Camel IoC friendly?

The quick answer is, yes absolutely! (smile). Now for the longer answer...


In particular we've gone out of our way to make Camel work great with Spring and to reuse all of Spring 2.x's power. For example

  • the CamelContext, Components and Endpoints and their dependent beans can be configured in Spring using Spring custom XML namespaces or traditional bean/property elements
  • we implement a spring BeanPostProcessor to allow POJOs to be injected with Camel resources along with powerful Bean Integration which allows any spring-injected POJO to be used inside Camel along with full support for Spring Remoting.

What we've tried to do is implement the Inversion Of Control With Smart Defaults pattern; namely that you can configure Camel in a single XML element (or very small amont of XML) to get going, then you can overload default configurations to add more explicit configuration as and when you need it.

Other IoC containers

Spring is clearly the leading IoC container; though there are some others such as Guice, OSGi, Pico, HiveMind & Plexus so we have made the IoC pluggable in Camel.
For example camel-core has no dependencies on anything other than commons-logging; camel-spring contains all the Spring integration etc.

We hope to have closer integration to other IoC containers, particularly with Guice. The current mechanism for hooking into other IoC containers are

Using no IoC container

Some folks don't even use an IoC container and thats fine too (smile). For example you can just use camel-core with pure Java and then wire things together using just Java code (or some scripting language etc).

By default when referring to components, endpoints or beans by name, it'll try look them up in the JNDI context and we've got a POJO based JNDI provier if you need one of those too.