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



##########
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:
       I did not ask for not creating sqlSessionFactory for each data source. 
(I have no idea whether that makes sense for Quarkivese MyBatis at all). I 
asked about the case when the list of sqlSessionFactoryBuildItems is empty. Is 
it made impossible somewhere in Quarkivese MyBatis or here? Because otherwise 
`sqlSessionFactoryBuildItem.get(0)` may throw an 
`ArrayIndexOutOfBoundsException` or similar and it would not inform the end 
user that (and where) he needs to define a datasource.




-- 
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