The <bean> is spring handling those, so setup spring property
placeholders to let it does its work there.
Camel's property placeholder is from whats inside <camelContext>.
You can bridge the two of them.

See more details in the camel website

On Fri, Feb 19, 2016 at 11:38 PM, Launcelot <[email protected]> wrote:
> I have a property file defined as follows
> <camelContext trace="true"
>                 id="context-c2d439e2-f530-4c6d-8480-86f290cbf297"
> xmlns="http://camel.apache.org/schema/spring";>
>
>                 <propertyPlaceholder id="properties" location="db.properties"
> propertyPrefix="${" propertySuffix="}"/>
>                 <route>
> db.properties has a property in it which contains
> db.pass=valuesnipped
>
>
> I have a datasource definition as under
> <bean id="myDataSource" class="org.apache.tomcat.jdbc.pool.DataSource">
>                 <property name="driverClassName" 
> value="oracle.jdbc.driver.OracleDriver"
> />
>                 <property name="url" value="jdbc:oracle:thin:@seq1:1521:sfgd" 
> />
>                 <property name="username" value="valuesnipped" />
>                 <property name="password" value="${db.pass}" />
>                 <property name="maxWait" value="1000" />
>                 <property name="validationQueryTimeout" value="3" />
>                 <property name="initialSize" value="8" />
>                 <property name="maxIdle" value="32" />
>                 <property name="removeAbandoned" value="true" />
>                 <property name="removeAbandonedTimeout" value="60" />
>                 <property name="logValidationErrors" value="true" />
>                 <property name="testWhileIdle" value="true" />
>                 <property name="testOnBorrow" value="true" />
>                 <property name="testOnConnect" value="true" />
>                 <property name="testOnReturn" value="false" />
>                 <property name="validationQuery" value="/* Oracle Health 
> Check */ SELECT 1
> FROM DUAL" />
>
>         </bean>
>
> I get exceptions connecting to the database indicating invalid
> user/password. I have tried using {{db.pass}} which also does not work,
> probably because it is literally assigning the value as {{db.pass}}. If i
> just use the actual password above it works fine. The aim is ultimately to
> use jasypt but that is a problem for another day.
>
> Any help indicating how I can accomplish setting the password from a
> property file is appreciated.
>
> Thanks
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Usage-of-properties-in-datasource-definition-Please-help-tp5777954.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to