...
As usually Camel provides a pluggable mechanism which allows 3rd part to provide their own resolver to lookup properties. Camel provides a default implementation org.apache.camel.component.properties.DefaultPropertiesResolver
which is capable of loading properties from the file system, classpath or classpath Registry. You can prefix the locations with either file:
or classpath:
where classpath:
is :
ref:
Camel 2.4: to lookup in the Registryfile:
to load the from file systemclasspath:
to load from classpath (this is also the default if no prefix is provided
...
- )
Defining location
The PropertiesResolver
need to know a location(s) where to resolve the properties. You can define 1 to many locations. If you define the location in a single String property you can separate multiple locations with comma such as:
...
Code Block | ||||
---|---|---|---|---|
| ||||
<camelContext ...>
<propertyPlaceholder id="properties" location="com/mycompany/myprop.properties"/>
</camelContext>
|
Using a Properties from the Registry
Available as of Camel 2.4
For example in OSGi you may want to expose a service which returns the properties as a java.util.Properties
object.
Then you could setup the Properties component as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
<propertyPlaceholder id="properties" location="ref:myProperties"/>
|
Where myProperties
is the id to use for lookup in the OSGi registry. Notice we use the ref:
prefix to tell Camel that it should lookup the properties for the Registry.
Examples using properties component
...