title: Alternative to long URI to configure a Camel Endpoint with Spring beans?
body: <p>I tried to find a way to configure a Camel endpoint using a spring bean that is referenced from the endpoint declaration in route in a camel context, but it does not work. </p>
  
  <p>For exemple, sometime defining an endpoint URI with many parameters is very horrible (!!), it would be lot more easier to configure the endpoint with a bean and its properties. (Or even better, when configuring a endpoint in XML, maybe the  or  elements should have sub-elements like a regular beans where we could configure the parameters of the endpoint).</p>
  
  <p>The first approach below work well and is very standard and pretty simple. The second approach, is the one I would like to use instead, but it does not work. I tried with many variations, but without success! The third alternative below would just be an interesting proposal for Camel developers in fact, but it also illustrate my point.</p>
  
  <p>In my example below, I only configured 3 parameters for the file endpoint, but imagine the URI with 10 parameters!! My question is how can I make my second approach working properly, I'm sure there is a simple solution!? I also tried using a factory-bean and a factory method, but it diid not work neither. </p>
  
  <p>1) Standard way to configure a camel endpoint in XML (spring beans):</p>
  
  <pre><code>...
  &lt;camel:camelContext id="camelContext"  &gt;
  
      &lt;camel:route id="deviceDataLogsPoller"  &gt;
          &lt;camel:from uri="file://long/path/to/input?preMove=../inprogress&amp;amp;move=../done&amp;amp;moveFailed=../error" /&gt;
  
          &lt;camel:log message="Input device data file read from file in input folder {{im.filePoller.folder.input}}." loggingLevel="INFO" /&gt;
  
      &lt;/camel:route&gt;
  &lt;/camel:camelContext&gt;
  </code></pre>
  
  <p>2) Alternative that I expected to be valide but that does not work (for me!):</p>
  
  <pre><code>&lt;bean id="filePoller" class="org.apache.camel.component.file.FileEndpoint" &gt;
  
      &lt;property name="camelContext" ref="camelContext" /&gt;
      &lt;property name="localWorkDirectory" value="/long/path/to/input" /&gt;
      &lt;property name="preMove"   value="../inprogress" /&gt;
      &lt;property name="move"       value="../done" /&gt;
      &lt;property name="moveFailed" value="../error" /&gt;
      ...
  &lt;/bean&gt;
  
  ...
  &lt;camel:camelContext id="camelContext"  &gt;
  
      &lt;camel:route id="deviceDataLogsPoller"  &gt;
          &lt;camel:from ref="filePoller" /&gt;
  
          &lt;camel:log message="Input device data file read from file in input folder {{im.filePoller.folder.input}}." loggingLevel="INFO" /&gt;
  
      &lt;/camel:route&gt;
  &lt;/camel:camelContext&gt;
  </code></pre>
  
  <p>3) Alternative that would be interesting in the future (mixed between two alternatives above):</p>
  
  <p>...
      </p>
  
  <pre><code>    &lt;camel:route id="deviceDataLogsPoller"  &gt;
          &lt;camel:from uri="file://long/path/to/input" &gt;
               &lt;property name="preMove"   value="../inprogress" /&gt;
               &lt;property name="move"       value="../done" /&gt;
               &lt;property name="moveFailed" value="../error" /&gt;
               ...
          &lt;/camel:from&gt;
  
          &lt;camel:log message="Input device data file read from file in input folder {{im.filePoller.folder.input}}." loggingLevel="INFO" /&gt;
  
      &lt;/camel:route&gt;
  &lt;/camel:camelContext&gt;
  </code></pre>