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


The following commit(s) were added to refs/heads/main by this push:
     new 819854f5f64 CAMEL-20735: camel-jbang - Add support for spring-boot 
datasource
819854f5f64 is described below

commit 819854f5f64ea684450c9eb292c45d6964908b70
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Mon May 6 09:22:18 2024 +0200

    CAMEL-20735: camel-jbang - Add support for spring-boot datasource
---
 .../modules/ROOT/pages/camel-jbang.adoc            | 28 +++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index 836d4d897e3..1829fc23105 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -2141,9 +2141,28 @@ That's it - Camel context will then look up for the 
instances of `org.apache.cam
 
 When using SQL databases, then you would often need to configure a JDBC 
connection pool. You can do this:
 
-- Manually by adding 3rd party JAR dependency on a connection pool, and 
configure this from Java code.
+- Manually by adding 3rd party JAR dependency for the data source (and 
connection pool), and configure this from Java or XML/YAML DSL.
 - *Camel 4.6* Spring Boot style with `spring.datasource.` configuration in 
`application.properties` (uses Hikari connection-pool)
 
+==== Defining datasource in YAML DSL as a bean
+
+Here is a snippet how you can declare a bean as the `DataSource` for a 
Postgres database in YAML DSL:
+
+[source,yaml]
+----
+- beans:
+    - name: PostgresqlDataSource
+      properties:
+        databaseName: "postgres"
+        password: "postgres"
+        portNumber: "5432"
+        serverName: localhost
+        user: postgres
+      type: org.postgresql.ds.PGSimpleDataSource
+----
+
+You would then also need to add the JAR dependency with Maven coordinates: 
`org.postgresql:postgresql:42.7.3`.
+
 ==== Using Spring Boot JDBC data source
 
 In `application.properties` you can set up the datasource such as:
@@ -2156,6 +2175,13 @@ spring.datasource.password=password
 spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
 ----
 
+The name of the `DataSource` will be registered with `springDataSource`, 
however you can configure the name via:
+
+[source,properties]
+----
+spring.datasource.name=myDataSourceNameHere
+----
+
 TIP: Some JDBC drivers are automatic detected by camel-jbang. If not then you 
need to add the JAR dependency manually.
 
 And you can configure the Hikari connection-pool (if needed) such as:

Reply via email to