prop fixes

This commit is contained in:
Anthony Stirling 2024-12-11 22:09:35 +00:00
parent eb20f51958
commit c20d37518d

View File

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