|
18 | 18 |
|
19 | 19 | import org.springframework.boot.SpringApplication;
|
20 | 20 | import org.springframework.boot.autoconfigure.SpringBootApplication;
|
| 21 | +import org.springframework.boot.builder.SpringApplicationBuilder; |
| 22 | +import org.springframework.boot.web.support.SpringBootServletInitializer; |
21 | 23 | import org.springframework.scheduling.annotation.EnableAsync;
|
22 | 24 | import org.springframework.scheduling.annotation.EnableScheduling;
|
23 | 25 |
|
|
28 | 30 | @SpringBootApplication
|
29 | 31 | @EnableAsync
|
30 | 32 | @EnableScheduling
|
31 |
| -public class App { |
32 |
| - |
33 |
| - public static void main(String[] args) { |
34 |
| - |
35 |
| - List<String> logLevels = new ArrayList<>(); |
36 |
| - Collections.addAll(logLevels, "ALL", "DEBUG", "ERROR", "FATAL", "INFO", "TRACE", "WARN"); |
37 |
| - |
38 |
| - if(args != null && args.length > 0 && logLevels.contains(args[0])) { |
39 |
| - System.setProperty("logging.level.root", args[0]); |
40 |
| - System.setProperty("logging.level.org.springframework.web", args[0]); |
41 |
| - System.setProperty("logging.level.com.ericsson.ei", args[0]); |
42 |
| - } else { |
43 |
| - System.setProperty("logging.level.root", "OFF"); |
44 |
| - System.setProperty("logging.level.org.springframework.web", "OFF"); |
45 |
| - System.setProperty("logging.level.com.ericsson.ei", "OFF"); |
46 |
| - } |
47 |
| - |
48 |
| - SpringApplication.run(App.class, args); |
49 |
| - } |
| 33 | +public class App extends SpringBootServletInitializer { |
| 34 | + |
| 35 | + @Override |
| 36 | + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
| 37 | + return application.sources(App.class); |
| 38 | + } |
| 39 | + |
| 40 | + public static void main(String[] args) { |
| 41 | + |
| 42 | + List<String> logLevels = new ArrayList<>(); |
| 43 | + Collections.addAll(logLevels, "ALL", "DEBUG", "ERROR", "FATAL", "INFO", "TRACE", "WARN"); |
| 44 | + |
| 45 | + if (args != null && args.length > 0 && logLevels.contains(args[0])) { |
| 46 | + System.setProperty("logging.level.root", args[0]); |
| 47 | + System.setProperty("logging.level.org.springframework.web", args[0]); |
| 48 | + System.setProperty("logging.level.com.ericsson.ei", args[0]); |
| 49 | + } else { |
| 50 | + System.setProperty("logging.level.root", "OFF"); |
| 51 | + System.setProperty("logging.level.org.springframework.web", "OFF"); |
| 52 | + System.setProperty("logging.level.com.ericsson.ei", "OFF"); |
| 53 | + } |
| 54 | + |
| 55 | + SpringApplication.run(App.class, args); |
| 56 | + } |
50 | 57 |
|
51 | 58 | }
|
0 commit comments