Example with Spring XML - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

In Spring XML you need to configure the JasyptPropertiesParser which is shown below. Then the Camel Camel Component: Properties component is told to use jasypt as the properties parser, which means Camel Component: Jasypt has its chance to decrypt values looked up in the properties.

<!-- define the jasypt properties parser with the given password -->
<bean id="jasypt"
   class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
   <property name="password" value="secret"/>
</bean>

<!-- define the Camel properties component -->
<bean id="properties" 
   class="org.apache.camel.component.properties.PropertiesComponent">
   <!-- the properties file is in the classpath -->
   <property name="location" value=
      "classpath:org/apache/camel/component/jasypt/myprops.properties"/>
   <!-- and let it leverage the jasypt parser -->
   <property name="propertiesParser" ref="jasypt"/>
</bean>

The Camel Component: Properties component can also be inlined inside the <camelContext> tag which is shown below. Notice how we use the propertiesParserRef attribute to refer to Camel Component: Jasypt .

<!-- define the jasypt properties parser with the given password -->
<bean id="jasypt" 
   class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
   <!-- password is mandatory, you can prefix it with sysenv: or sys: 
      to indicate it should use an OS environment or JVM system property 
      value, so you don't have the master password defined here -->
   <property name="password" value="secret"/>
</bean>

<camelContext xmlns="http://camel.apache.org/schema/spring">
   <!-- define the Camel properties placeholder to use jasypt -->
   <propertyPlaceholder id="properties" location=
      "classpath:org/apache/camel/component/jasypt/   \\
      myproperties.properties"
      propertiesParserRef="jasypt"/>
   <route>
      <from uri="direct:start"/>
      <to uri="{{cool.result}}"/>
   </route>
</camelContext>