1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.catalog.config;
18
19 import org.apache.logging.log4j.LogManager;
20 import org.apache.logging.log4j.Logger;
21 import org.apache.logging.log4j.catalog.api.util.ProfileUtil;
22 import org.springframework.boot.web.servlet.ServletContextInitializer;
23 import org.springframework.context.annotation.Bean;
24 import org.springframework.context.annotation.Configuration;
25 import org.springframework.web.WebApplicationInitializer;
26 import org.springframework.web.context.ContextLoaderListener;
27 import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
28 import org.springframework.web.servlet.DispatcherServlet;
29
30 import javax.servlet.ServletContext;
31 import javax.servlet.ServletException;
32 import javax.servlet.ServletRegistration;
33
34 public class WebAppInitializer {
35 private static final String APPLICATION_NAME = "AuditCatalog";
36 private static Logger LOGGER = LogManager.getLogger(WebAppInitializer.class);
37
38 @Bean
39 public ServletContextInitializer initializer() {
40 return new ServletContextInitializer() {
41
42 @Override
43 public void onStartup(ServletContext servletContext) throws ServletException {
44 LOGGER.info("Starting Audit Catalog Editor");
45 servletContext.setInitParameter("applicationName", APPLICATION_NAME);
46 ProfileUtil.setActiveProfile(servletContext);
47 servletContext.setInitParameter("isEmbedded", "true");
48 System.setProperty("applicationName", APPLICATION_NAME);
49
50
51
52
53
54
55
56
57 }
58 };
59 }
60 }