title: Read template from the database - VelocityEngine
body: <p>I am storing the templates I use with velocity in the DB and I wan to configure it to read the templates from the DB.</p>
  
  <p>my bean definition is:</p>
  
  <pre><code>&lt;bean id="velocityEngineBasedOnDB" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"&gt;
      &lt;property name="velocityProperties"&gt;
          &lt;map&gt;
              &lt;entry key="resource.loader" value="ds"/&gt;
              &lt;entry key="ds.resource.loader.class" value="org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader"/&gt;
              &lt;entry key="ds.resource.loader.resource.table" value="tb_velocity_template"/&gt;
              &lt;entry key="ds.resource.loader.resource.keycolumn" value="id_template"/&gt;
              &lt;entry key="ds.resource.loader.resource.templatecolumn" value="template_definition"/&gt;
              &lt;entry key="ds.resource.loader.resource.datasource" value-ref="dataSource"/&gt;
          &lt;/map&gt;
      &lt;/property&gt; 
   &lt;/bean&gt;
  </code></pre>
  
  <p>but I got java.lang.ClassCastException: 'resource.datasource' doesn't map to a String object.</p>
  
  <p>So how I configure the data source as string?</p>