You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by fm...@apache.org on 2023/05/15 16:45:04 UTC

[camel] branch main updated: Autowire sqlSessionFactory

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

fmariani 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 4c745160b13 Autowire sqlSessionFactory
4c745160b13 is described below

commit 4c745160b13a034da891bfdf4cb0450a56f0ff29
Author: Croway <fe...@gmail.com>
AuthorDate: Mon May 15 17:41:30 2023 +0200

    Autowire sqlSessionFactory
---
 .../camel/component/mybatis/MyBatisBeanComponentConfigurer.java      | 5 +++++
 .../apache/camel/component/mybatis/MyBatisComponentConfigurer.java   | 5 +++++
 .../resources/org/apache/camel/component/mybatis/mybatis-bean.json   | 2 +-
 .../resources/org/apache/camel/component/mybatis/mybatis.json        | 2 +-
 .../java/org/apache/camel/component/mybatis/MyBatisComponent.java    | 2 +-
 5 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/components/camel-mybatis/src/generated/java/org/apache/camel/component/mybatis/MyBatisBeanComponentConfigurer.java b/components/camel-mybatis/src/generated/java/org/apache/camel/component/mybatis/MyBatisBeanComponentConfigurer.java
index fa08fa958cd..186a5c3696c 100644
--- a/components/camel-mybatis/src/generated/java/org/apache/camel/component/mybatis/MyBatisBeanComponentConfigurer.java
+++ b/components/camel-mybatis/src/generated/java/org/apache/camel/component/mybatis/MyBatisBeanComponentConfigurer.java
@@ -33,6 +33,11 @@ public class MyBatisBeanComponentConfigurer extends PropertyConfigurerSupport im
         }
     }
 
+    @Override
+    public String[] getAutowiredNames() {
+        return new String[]{"sqlSessionFactory"};
+    }
+
     @Override
     public Class<?> getOptionType(String name, boolean ignoreCase) {
         switch (ignoreCase ? name.toLowerCase() : name) {
diff --git a/components/camel-mybatis/src/generated/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurer.java b/components/camel-mybatis/src/generated/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurer.java
index eff2427a770..8b50b4f93e3 100644
--- a/components/camel-mybatis/src/generated/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurer.java
+++ b/components/camel-mybatis/src/generated/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurer.java
@@ -35,6 +35,11 @@ public class MyBatisComponentConfigurer extends PropertyConfigurerSupport implem
         }
     }
 
+    @Override
+    public String[] getAutowiredNames() {
+        return new String[]{"sqlSessionFactory"};
+    }
+
     @Override
     public Class<?> getOptionType(String name, boolean ignoreCase) {
         switch (ignoreCase ? name.toLowerCase() : name) {
diff --git a/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis-bean.json b/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis-bean.json
index 83b2de59449..61f24a93cdc 100644
--- a/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis-bean.json
+++ b/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis-bean.json
@@ -25,7 +25,7 @@
     "configurationUri": { "kind": "property", "displayName": "Configuration Uri", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "SqlMapConfig.xml", "description": "Location of MyBatis xml configuration file. The default value is: SqlMapConfig.xml loaded from the classpath" },
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...]
     "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
-    "sqlSessionFactory": { "kind": "property", "displayName": "Sql Session Factory", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.ibatis.session.SqlSessionFactory", "deprecated": false, "autowired": false, "secret": false, "description": "To use the SqlSessionFactory" }
+    "sqlSessionFactory": { "kind": "property", "displayName": "Sql Session Factory", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.ibatis.session.SqlSessionFactory", "deprecated": false, "autowired": true, "secret": false, "description": "To use the SqlSessionFactory" }
   },
   "headers": {
     "CamelMyBatisResult": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The response returned from MtBatis in any of the operations. For instance an INSERT could return the auto-generated key, or number of rows etc.", "constantName": "org.apache.camel.component.mybatis.MyBatisConstants#MYBATIS_RESULT" }
diff --git a/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis.json b/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis.json
index 3285e00f36d..df9ccb7ce09 100644
--- a/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis.json
+++ b/components/camel-mybatis/src/generated/resources/org/apache/camel/component/mybatis/mybatis.json
@@ -26,7 +26,7 @@
     "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a me [...]
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...]
     "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
-    "sqlSessionFactory": { "kind": "property", "displayName": "Sql Session Factory", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.ibatis.session.SqlSessionFactory", "deprecated": false, "autowired": false, "secret": false, "description": "To use the SqlSessionFactory" }
+    "sqlSessionFactory": { "kind": "property", "displayName": "Sql Session Factory", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.ibatis.session.SqlSessionFactory", "deprecated": false, "autowired": true, "secret": false, "description": "To use the SqlSessionFactory" }
   },
   "headers": {
     "CamelMyBatisResult": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The response returned from MtBatis in any of the operations. For instance an INSERT could return the auto-generated key, or number of rows etc.", "constantName": "org.apache.camel.component.mybatis.MyBatisConstants#MYBATIS_RESULT" },
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java
index 0c319f67d51..699491c1c51 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java
@@ -33,7 +33,7 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder;
 @Component("mybatis")
 public class MyBatisComponent extends DefaultComponent {
 
-    @Metadata(label = "advanced")
+    @Metadata(label = "advanced", autowired = true)
     private SqlSessionFactory sqlSessionFactory;
     @Metadata(defaultValue = "SqlMapConfig.xml")
     private String configurationUri = "SqlMapConfig.xml";