You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/04/11 16:39:03 UTC

[camel] 02/02: CAMEL-17939: camel-main - Configure camel.beans map style using square brackets

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 899a0cfe81d781dd4fe145cadbaee6f8ccbd0d8a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Apr 11 18:38:45 2022 +0200

    CAMEL-17939: camel-main - Configure camel.beans map style using square brackets
---
 core/camel-main/src/main/docs/main.adoc | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc
index f3fa102b63b..2d79cc576ac 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -458,6 +458,32 @@ and not just a text value that happens to start with a `+#+` sign:
 camel.component.sql.dataSource = #bean:myDS
 ----
 
+=== Creating a custom map bean
+
+When creating a bean as a `java.util.Map` type, then you can use the `[]` syntax as shown below:
+
+[source,properties]
+----
+camel.beans.myApp[id] = 123
+camel.beans.myApp[name] = Demo App
+camel.beans.myApp[version] = 1.0.1
+camel.beans.myApp[username] = goofy
+----
+
+Camel will then create this as a `LinkedHashMap` type with the name `myApp` which is
+bound to the Camel xref:manual::registry.adoc[Registry], with the data defined in the properties.
+
+If you desire a different `java.util.Map` implementation, then you can use `#class` style as shown:
+
+[source,properties]
+----
+camel.beans.myApp = #class:com.foo.MyMapImplementation
+camel.beans.myApp[id] = 123
+camel.beans.myApp[name] = Demo App
+camel.beans.myApp[version] = 1.0.1
+camel.beans.myApp[username] = goofy
+----
+
 === Creating a custom bean with constructor parameters
 
 When creating a bean then parameters to the constructor can be provided.