diff --git a/src/main/java/stirling/software/SPDF/SPdfApplication.java b/src/main/java/stirling/software/SPDF/SPdfApplication.java index 191086a4..5b2c1bed 100644 --- a/src/main/java/stirling/software/SPDF/SPdfApplication.java +++ b/src/main/java/stirling/software/SPDF/SPdfApplication.java @@ -75,10 +75,14 @@ public class SPdfApplication { public static void main(String[] args) throws IOException, InterruptedException { - System.setProperty("java.awt.headless", "false"); + SpringApplication app = new SpringApplication(SPdfApplication.class); - app.setHeadless(false); + + if("true".equals(System.getenv("STIRLING_PDF_DESKTOP_UI"))) { + System.setProperty("java.awt.headless", "false"); + app.setHeadless(false); + } app.setAdditionalProfiles("default"); app.addInitializers(new ConfigInitializer()); Map propertyFiles = new HashMap<>();