This commit is contained in:
Anthony Stirling
2024-12-11 23:13:23 +00:00
parent 11273b1589
commit 1c5dfc46a0
3 changed files with 20 additions and 15 deletions

View File

@@ -75,19 +75,17 @@ public class SPdfApplication {
public static void main(String[] args) throws IOException, InterruptedException {
SpringApplication app = new SpringApplication(SPdfApplication.class);
Properties props = new Properties();
if("true".equals(System.getenv("STIRLING_PDF_DESKTOP_UI"))) {
System.setProperty("java.awt.headless", "false");
app.setHeadless(false);
props.put("java.awt.headless", "false");
props.put("spring.main.web-application-type", "servlet");
if ("true".equals(System.getenv("STIRLING_PDF_DESKTOP_UI"))) {
System.setProperty("java.awt.headless", "false");
app.setHeadless(false);
// props.put("java.awt.headless", "false");
// props.put("spring.main.web-application-type", "servlet");
}
app.setAdditionalProfiles("default");
app.addInitializers(new ConfigInitializer());
Map<String, String> propertyFiles = new HashMap<>();
@@ -112,10 +110,17 @@ public class SPdfApplication {
logger.warn("Custom configuration file 'configs/custom_settings.yml' does not exist.");
}
Properties finalProps = new Properties();
finalProps.putAll(Collections.singletonMap(
"spring.config.additional-location",
propertyFiles.get("spring.config.additional-location")));
finalProps.putAll(props);
if (!propertyFiles.isEmpty()) {
finalProps.putAll(
Collections.singletonMap(
"spring.config.additional-location",
propertyFiles.get("spring.config.additional-location")));
}
if (props.isEmpty()) {
finalProps.putAll(props);
}
app.setDefaultProperties(finalProps);
app.run(args);