99import javax .enterprise .context .spi .CreationalContext ;
1010import javax .enterprise .inject .Any ;
1111import javax .enterprise .inject .spi .Bean ;
12+ import javax .enterprise .inject .spi .BeanManager ;
1213import javax .enterprise .inject .spi .CDI ;
1314
1415import org .graalvm .nativeimage .ImageInfo ;
@@ -62,11 +63,11 @@ private ApplicationLifecycleManager() {
6263 private static boolean hooksRegistered ;
6364 private static boolean vmShuttingDown ;
6465
65- public static final void run (Application application , String ... args ) {
66+ public static void run (Application application , String ... args ) {
6667 run (application , null , null , args );
6768 }
6869
69- public static final void run (Application application , Class <? extends QuarkusApplication > quarkusApplication ,
70+ public static void run (Application application , Class <? extends QuarkusApplication > quarkusApplication ,
7071 Consumer <Integer > exitCodeHandler , String ... args ) {
7172 stateLock .lock ();
7273 //in tests we might pass this method an already started application
@@ -90,7 +91,8 @@ public static final void run(Application application, Class<? extends QuarkusApp
9091 application .start (args );
9192 //now we are started, we either run the main application or just wait to exit
9293 if (quarkusApplication != null ) {
93- Set <Bean <?>> beans = CDI .current ().getBeanManager ().getBeans (quarkusApplication , new Any .Literal ());
94+ BeanManager beanManager = CDI .current ().getBeanManager ();
95+ Set <Bean <?>> beans = beanManager .getBeans (quarkusApplication , Any .Literal .INSTANCE );
9496 Bean <?> bean = null ;
9597 for (Bean <?> i : beans ) {
9698 if (i .getBeanClass () == quarkusApplication ) {
@@ -102,9 +104,8 @@ public static final void run(Application application, Class<? extends QuarkusApp
102104 if (bean == null ) {
103105 instance = quarkusApplication .newInstance ();
104106 } else {
105- CreationalContext <?> ctx = CDI .current ().getBeanManager ().createCreationalContext (bean );
106- instance = (QuarkusApplication ) CDI .current ().getBeanManager ().getReference (bean ,
107- quarkusApplication , ctx );
107+ CreationalContext <?> ctx = beanManager .createCreationalContext (bean );
108+ instance = (QuarkusApplication ) beanManager .getReference (bean , quarkusApplication , ctx );
108109 }
109110 int result = -1 ;
110111 try {
@@ -222,7 +223,7 @@ public static boolean isVmShuttingDown() {
222223 * By default this will just call System.exit, however this is not always
223224 * what is wanted.
224225 *
225- * @param defaultExitCodeHandler
226+ * @param defaultExitCodeHandler the new default exit handler
226227 */
227228 public static void setDefaultExitCodeHandler (Consumer <Integer > defaultExitCodeHandler ) {
228229 Objects .requireNonNull (defaultExitCodeHandler );
0 commit comments