コード例 #1
0
 public static void main(String[] args) {
   TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
   SpringApplication app = new SpringApplication(Application.class);
   app.addListeners(
       new ApplicationListener<ApplicationEnvironmentPreparedEvent>() {
         @Override
         public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
           MDC.put("appName", event.getEnvironment().getProperty("project.name"));
           MDC.put("requestId", "N/A");
           try {
             MDC.put("hostName", InetAddress.getLocalHost().getHostName());
           } catch (IllegalArgumentException | UnknownHostException e) {
             log.info(e);
           }
         }
       });
   ApplicationContext ctx = app.run(args);
   log.info("-----------------------------------------------------------------");
   log.info("Active profiles:");
   Arrays.asList(ctx.getEnvironment().getActiveProfiles()).forEach(log::info);
   log.info("-----------------------------------------------------------------");
 }
コード例 #2
0
 public static void main(final String[] args) {
   SpringApplication springApplication = new SpringApplication(Application.class);
   springApplication.addListeners(new ApplicationPidFileWriter("openlrs.pid"));
   springApplication.run(args);
 }
コード例 #3
0
 public static void main(String[] args) {
   TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
   SpringApplication springApplication = new SpringApplication(Application.class);
   springApplication.addListeners(new ApplicationPidFileWriter());
   springApplication.run(args);
 }