blob: 4f2d87730022a30d1f4627e4e0562ce15bb30956 [file] [log] [blame]
[[Injector-Injector]]
Injector
~~~~~~~~
The
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/Injector.html[Injector]
is a pluggable strategy to any IoC container such as
Spring or Guice to be able to create and
dependency-inject objects of a certain type.
For example if you are using the
link:inversion-of-control-with-smart-defaults.html[Inversion Of Control
With Smart Defaults] pattern to minimize your XML dependency; Camel will
automatically discover and use new endpoints when they are referenced
via their URIs by using the META-INF/services settings.
You could explicitly configure each Component and
Endpoint in your Spring XML file; or let Camel find
the defaults then use the Injector to create and inject any of its
dependencies.
As an example; consider the <<jms-component,JMS>> component. Rather than
explicitly configuring the JMS component in Spring XML you can just
provide a ConnectionFactory in your Spring XML which the Injector will
use to properly configure the JmsComponent when it is instantiated.