[#ftl]
[#if properties.dataSourceName?has_content]
    <reference id="dataSource" interface="javax.sql.DataSource" availability="mandatory"
               filter="(osgi.jndi.service.name=[=properties.dataSourceName])"/>
[#else]
    <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource">
        <property name="url" value="[=properties.dataSourceUrl]"/>
        <property name="driverClassName" value="[=properties.dataSourceClass]"/>
        <property name="username" value="[=properties.dataSourceUsername!]"/>
        <property name="password" value="[=properties.dataSourcePassword!]"/>
    </bean>
[/#if]

    <bean id="[=objectId]" class="org.apache.camel.component.jdbc.JdbcComponent">
        [=utils.createBeanProperties(properties, "camel_", true)]
        <property name="dataSource" ref="dataSource"/>
    </bean>
