You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2022/12/23 22:08:54 UTC

[myfaces] branch main updated: startup hack

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 7a0f5cf85 startup hack
7a0f5cf85 is described below

commit 7a0f5cf85b893b0fac876b1cd378eb95b52bd604
Author: tandraschko <ta...@apache.org>
AuthorDate: Fri Dec 23 23:08:48 2022 +0100

    startup hack
---
 .../quarkus/runtime/QuarkusFacesInitializer.java   | 28 ++++++++++++++--------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/QuarkusFacesInitializer.java b/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/QuarkusFacesInitializer.java
index f3b839ea2..380100fce 100644
--- a/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/QuarkusFacesInitializer.java
+++ b/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/QuarkusFacesInitializer.java
@@ -36,20 +36,28 @@ import org.apache.myfaces.core.extensions.quarkus.runtime.spi.QuarkusFactoryFind
  */
 public class QuarkusFacesInitializer extends FacesInitializerImpl
 {
-
+    private static boolean initialized = false;
+    
     @Override
     public void initFaces(ServletContext servletContext)
     {
-        FactoryFinderProviderFactory.setInstance(new QuarkusFactoryFinderProviderFactory());
-
-        // see FacesDataModelExtension
-        FacesDataModelManager facesDataModelManager = CDI.current().select(FacesDataModelManager.class).get();
-        for (Map.Entry<Class<? extends DataModel>, Class<?>> typeInfo : MyFacesRecorder.FACES_DATA_MODELS.entrySet())
+        // DIRTY HACK as somehow quarkus initializes a second time?
+        if (!initialized)
         {
-            facesDataModelManager.addFacesDataModel(typeInfo.getValue(), typeInfo.getKey());
-        }
-        facesDataModelManager.init();
+            initialized = true;
 
-        super.initFaces(servletContext);
+            FactoryFinderProviderFactory.setInstance(new QuarkusFactoryFinderProviderFactory());
+
+            // see FacesDataModelExtension
+            FacesDataModelManager facesDataModelManager = CDI.current().select(FacesDataModelManager.class).get();
+            for (Map.Entry<Class<? extends DataModel>, Class<?>> typeInfo
+                    : MyFacesRecorder.FACES_DATA_MODELS.entrySet())
+            {
+                facesDataModelManager.addFacesDataModel(typeInfo.getValue(), typeInfo.getKey());
+            }
+            facesDataModelManager.init();
+
+            super.initFaces(servletContext);
+        }
     }
 }