zhfeng commented on a change in pull request #2525:
URL: https://github.com/apache/camel-quarkus/pull/2525#discussion_r623127504



##########
File path: 
extensions/mybatis/deployment/src/main/java/org/apache/camel/quarkus/component/mybatis/deployment/MybatisProcessor.java
##########
@@ -34,13 +39,19 @@ FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep
+    CamelBeanBuildItem mybatisComponent(
+            List<SqlSessionFactoryBuildItem> sqlSessionFactoryBuildItem, 
CamelMyBatisRecorder recorder) {
+        return new CamelBeanBuildItem("mybatis", 
MyBatisComponent.class.getName(),
+                
recorder.createMyBatisComponent(sqlSessionFactoryBuildItem.get(0).getSqlSessionFactory()));
+    }
+
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep
+    CamelBeanBuildItem mybatisBeanComponent(
+            List<SqlSessionFactoryBuildItem> sqlSessionFactoryBuildItem, 
CamelMyBatisRecorder recorder) {
+        return new CamelBeanBuildItem("mybatis-bean", 
MyBatisBeanComponent.class.getName(),
+                
recorder.createMyBatisBeanComponent(sqlSessionFactoryBuildItem.get(0).getSqlSessionFactory()));

Review comment:
       Thanks @ppalaga and I will try this idea in 
https://github.com/quarkiverse/quarkus-mybatis/issues/84

##########
File path: 
integration-tests/mybatis/src/main/java/org/apache/camel/quarkus/component/mybatis/it/MybatisResource.java
##########
@@ -61,4 +77,44 @@ public Response loadComponentMybatisBean() throws Exception {
         LOG.warnf("Could not load [%s] from the Camel context", 
COMPONENT_MYBATIS_BEAN);
         return Response.status(500, COMPONENT_MYBATIS_BEAN + " could not be 
loaded from the Camel context").build();
     }
+

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to