aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/PdfAsWeb.java
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/PdfAsWeb.java')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/PdfAsWeb.java60
1 files changed, 19 insertions, 41 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/PdfAsWeb.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/PdfAsWeb.java
index 75042176..85d94a7f 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/PdfAsWeb.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/PdfAsWeb.java
@@ -1,57 +1,35 @@
package at.gv.egiz.pdfas.web;
-import lombok.val;
-import org.jetbrains.annotations.NotNull;
-import org.springframework.boot.EnvironmentPostProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.MapPropertySource;
-import java.util.HashMap;
+import at.gv.egiz.pdfas.web.config.PdfAsSpringBootApplicationContextInitializer;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
@SpringBootApplication
public class PdfAsWeb extends SpringBootServletInitializer {
- // registered in resources/META-INF/spring.factories
- public static class DefaultProperties implements EnvironmentPostProcessor {
- @Override
- public void postProcessEnvironment(
- @NotNull ConfigurableEnvironment environment, @NotNull SpringApplication application)
- {
- /*
- == DEFAULT PROPERTIES ==
- these are properties with the lowest precedence
- so anything else (pdf-as-web.properties, system params, etc) can override them
- */
- val defaultProperties = new HashMap<String, Object>();
- // set the default application name
- defaultProperties.put("spring.application.name", "PDF-AS Web");
- // disable spring boot admin client by default
- defaultProperties.put("spring.boot.admin.client.enabled", "false");
- // compatibility layer: map the old logback.configurationFile to the new logging.config
- val legacyLogProperty = System.getProperty("logback.configurationFile");
- if (legacyLogProperty != null) {
- defaultProperties.put("logging.config", legacyLogProperty);
- }
-
- /*
- == END DEFAULT PROPERTIES ==
- */
-
-
- environment.getPropertySources().addLast(new MapPropertySource("pdf-as-web-defaults", defaultProperties));
- }
- }
-
@Override
- protected @NotNull SpringApplicationBuilder configure(@NotNull SpringApplicationBuilder application) {
- return application.sources(PdfAsWeb.class);
+ protected SpringApplicationBuilder createSpringApplicationBuilder() {
+ SpringApplicationBuilder builder = new SpringApplicationBuilder();
+ builder.initializers(new PdfAsSpringBootApplicationContextInitializer());
+ builder.sources(PdfAsWeb.class);
+ return builder;
+
}
-
+
public static void main(String[] args) {
- SpringApplication.run(PdfAsWeb.class, args);
+ log.info("=============== Initializing Spring-Boot context! ===============");
+ final SpringApplication springApp = new SpringApplication(PdfAsWeb.class);
+ springApp.addInitializers(new PdfAsSpringBootApplicationContextInitializer());
+
+ log.debug("Run SpringBoot initialization process ... ");
+ springApp.run(args);
+
+ log.info("Initialization of PDF-AS-Web finished.");
+
}
}