title: Spring Boot + Apache Camel + Freemarker Custom Template Loader
body: <p>I am trying to create a Spring Boot application involving Apache Camel. </p>
  
  <p>The Camel routes consists of a transformation of message using FreeMarker Template (for this I am using Camel's Freemarker integration)</p>
  
  <pre><code>from("direct:temporary").routeId("hello").to("freemarker:db:test-spot").end().to("stream:out");
  </code></pre>
  
  <p>The Freemarker templates are stored in Database and I am trying to load it using a Custom Template Loader (say DBTemplateLoader)</p>
  
  <p>However, I haven't been successful yet! Reasons, even if I register my custom template loader, it resorts back to FreeMarkerComponent to load the templates, and of course it doesn't know my database.</p>
  
  <p>Here is the error I am getting</p>
  
  <pre><code>freemarker.template.TemplateNotFoundException: Template not found for name "db:test-spot".
  The name was interpreted by this TemplateLoader: org.apache.camel.component.freemarker.FreemarkerComponent$1@3dbbfc3a.
  </code></pre>
  
  <p>I have tried most of the resources on web. All these things work nicely isolation, but the Apache Camel + FreeeMarker + Custom Template Loader for Freemarker is just not working.</p>
  
  <p>If anyone can point me to the right direction, then I would be grateful.</p>