[
https://issues.apache.org/jira/browse/CAMEL-16607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17343766#comment-17343766
]
Claus Ibsen commented on CAMEL-16607:
-------------------------------------
Here is an example in XML DSL that works out of the box
{code}
<camelContext id="foo" xmlns="http://camel.apache.org/schema/spring">
<routeTemplate id="myTemplate">
<description>blah blah</description>
<templateParameter name="foo"/>
<templateParameter name="bar"/>
<templateParameter name="greeting"/>
<templateBean name="myBean"
type="#class:org.apache.camel.spring.routebuilder.MyLocalBean">
<property key="prefix" value="{{greeting}}"/>
</templateBean>
<route>
<from uri="direct:{{foo}}"/>
<to uri="bean:{{myBean}}"/>
<to uri="mock:{{bar}}"/>
</route>
</routeTemplate>
</camelContext>
{code}
So we could get the yaml dsl to parse the camel-core-model (without any
customization) then it could work the same
> RouteTemplateBeanDefinition : add suport for #type and #class languages
> -----------------------------------------------------------------------
>
> Key: CAMEL-16607
> URL: https://issues.apache.org/jira/browse/CAMEL-16607
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Luca Burgazzoli
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 3.10.0
>
>
> The way to create a template with local beans in the YAML DSl is like:
> {code:yaml}
> - template:
> id: "myTemplate"
> beans:
> - name: "myProcessor"
> type: “#class|#type:com.acme.Product”
> properties:
> - foo: "bar"
> {code}
> The bean is created by
> [NamedBeanDefinition::newInstance|https://github.com/apache/camel/blob/4299e1140bb821d02b71405608c0a03a60968c7e/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/NamedBeanDefinition.java#L63-L71]
> With the recent support for defining beans with a scripting language, we have
> some additional options and would be nice to merge the two ways in something
> like:
> {code:yaml}
> - template:
> id: "myTemplate"
> beans:
> - name: "myTypeBean"
> type: “#class|#type:...”
> properties:
> - foo: "bar"
> - name: "myScriptedBean"
> type: “groovy|joor|...”
> script: “”
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)