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,10 +88,12 @@ 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 );
@@ -104,6 +106,8 @@ public void init() throws Exception {
104
106
}
105
107
}).thenAcceptBothAsync (splashIsShowing , (ctx , closeSplash ) -> {
106
108
Platform .runLater (closeSplash );
109
+ // Shutdown the executor otherwise the application will never exit.
110
+ executor .shutdown ();
107
111
});
108
112
}
109
113
You can’t perform that action at this time.
0 commit comments