File tree 1 file changed +6
-2
lines changed
src/main/java/de/felixroske/jfxsupport
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -88,13 +88,16 @@ private void loadIcons(ConfigurableApplicationContext ctx) {
88
88
*/
89
89
@ Override
90
90
public void init () throws Exception {
91
- // Load in JavaFx Thread and reused by Completable Future, but should no be a big deal.
91
+ // Load in JavaFx Thread and reused by Completable Future, but should not be a big deal.
92
+ // Provide an executor instead of using default, otherwise spring application will fail to start via JAR(mvn package)
93
+ ExecutorService executor = Executors .newSingleThreadExecutor ();
92
94
defaultIcons .addAll (loadDefaultIcons ());
93
95
CompletableFuture .supplyAsync (() ->
94
- SpringApplication .run (this .getClass (), savedArgs )
96
+ SpringApplication .run (this .getClass (), savedArgs ), executor
95
97
).whenComplete ((ctx , throwable ) -> {
96
98
if (throwable != null ) {
97
99
LOGGER .error ("Failed to load spring application context: " , throwable );
100
+ executor .shutdown ();
98
101
Platform .runLater (() -> errorAction .accept (throwable ));
99
102
} else {
100
103
Platform .runLater (() -> {
@@ -103,6 +106,7 @@ public void init() throws Exception {
103
106
});
104
107
}
105
108
}).thenAcceptBothAsync (splashIsShowing , (ctx , closeSplash ) -> {
109
+ executor .shutdown ();
106
110
Platform .runLater (closeSplash );
107
111
});
108
112
}
You can’t perform that action at this time.
0 commit comments