fx-cdi/src/main/java/com/cathive/fx/cdi/JavaFXExtension.java
public static void setJavaFxApplication(final CdiApplication javaFxApplication) {

        final CountDownLatch latch = new CountDownLatch(1);
        Platform.runLater(() -> {
            JAVA_FX_APPLICATION.set(javaFxApplication);
            latch.countDown();
        });

        if (!Platform.isFxApplicationThread()) {
            try {
                latch.await();
            } catch (InterruptedException e) {
                throw new IllegalStateException(e);
            }
        }

    }
public static void setJavaFxApplication(final CdiApplication javaFxApplication) {

        final CountDownLatch latch = new CountDownLatch(1);
        Platform.runLater(() -> {
            JAVA_FX_APPLICATION.set(javaFxApplication);
            latch.countDown();
        });

        if (!Platform.isFxApplicationThread()) {
            try {
                latch.await();
            } catch (InterruptedException e) {
                throw new IllegalStateException(e);
            }
        }

    }
Sets the JavaFX application instance to be provided by the CDI BeanManager.
@param javaFxApplication
The JavaFX application instance to be provided by the CDI BeanManager.