...
Code Block |
---|
|
pc.setLocation("com/mycompany/myprop.properties,com/mycompany/other.properties");
|
Available as of Camel 2.19.0
You can set which location can be discarded if missing by by setting the optional
attribute, which is false by default, i.e:
Configuring in Spring XML
Code Block |
---|
|
pc.setLocations(
"com/mycompany/override.properties;optional=true"
"com/mycompany/defaults.properties"); |
Using System and Environment Variables in Locations
...
Code Block |
---|
|
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation("classpath:com/mycompany/myprop.properties");
context.addComponent("properties", pc);
|
Configuring in Spring XML
Spring XML offers two variations to configure. You can define a spring bean as a PropertiesComponent
which resembles the way done in Java DSL. Or you can use the <propertyPlaceholder>
tag.
...
Code Block |
---|
|
<camelContext ...>
<propertyPlaceholder id="properties" location="com/mycompany/myprop.properties"/>
</camelContext>
|
Setting the properties location through the location tag works just fine but sometime you have a number of resources to take into account and starting from Camel 2.19.0 you can set the properties location with a dedicated propertiesLocation:
Code Block |
---|
|
<camelContext ...>
<propertyPlaceholder id="myPropertyPlaceholder">
<propertiesLocation
resolver = "classpath"
path = "com/my/company/something/my-properties-1.properties"
optional = "false"/>
<propertiesLocation
resolver = "classpath"
path = "com/my/company/something/my-properties-2.properties"
optional = "false"/>
<propertiesLocation
resolver = "file"
path = "${karaf.home}/etc/my-override.properties"
optional = "true"/>
</propertyPlaceholder>
</camelContext> |
Tip |
---|
title | Specifying the cache option in XML |
---|
|
From Camel 2.10: Camel supports specifying a value for the cache option both inside the Spring as well as the Blueprint XML. |
...