當前位置: 首頁>>代碼示例>>Java>>正文


Java SpringApplication.exit方法代碼示例

本文整理匯總了Java中org.springframework.boot.SpringApplication.exit方法的典型用法代碼示例。如果您正苦於以下問題:Java SpringApplication.exit方法的具體用法?Java SpringApplication.exit怎麽用?Java SpringApplication.exit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.boot.SpringApplication的用法示例。


在下文中一共展示了SpringApplication.exit方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  // below is output *before* logging is configured so will appear on console
  logVersionInfo();

  try {
    SpringApplication.exit(new SpringApplicationBuilder(VacuumTool.class)
        .properties("spring.config.location:${config:null}")
        .properties("spring.profiles.active:" + Modules.REPLICATION)
        .properties("instance.home:${user.home}")
        .properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
        .bannerMode(Mode.OFF)
        .registerShutdownHook(true)
        .build()
        .run(args));
  } catch (BeanCreationException e) {
    if (e.getMostSpecificCause() instanceof BindException) {
      printVacuumToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
    }
    throw e;
  }
}
 
開發者ID:HotelsDotCom,項目名稱:circus-train,代碼行數:22,代碼來源:VacuumTool.java

示例2: main

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  // below is output *before* logging is configured so will appear on console
  logVersionInfo();

  try {
    SpringApplication.exit(new SpringApplicationBuilder(ComparisonTool.class)
        .properties("spring.config.location:${config:null}")
        .properties("spring.profiles.active:" + Modules.REPLICATION)
        .properties("instance.home:${user.home}")
        .properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
        .bannerMode(Mode.OFF)
        .registerShutdownHook(true)
        .build()
        .run(args));
  } catch (BeanCreationException e) {
    if (e.getMostSpecificCause() instanceof BindException) {
      printComparisonToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
      throw e;
    }
    if (e.getMostSpecificCause() instanceof IllegalArgumentException) {
      LOG.error(e.getMessage(), e);
      printComparisonToolHelp(Collections.<ObjectError> emptyList());
    }
  }
}
 
開發者ID:HotelsDotCom,項目名稱:circus-train,代碼行數:26,代碼來源:ComparisonTool.java

示例3: main

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  // below is output *before* logging is configured so will appear on console
  logVersionInfo();

  try {
    SpringApplication.exit(new SpringApplicationBuilder(FilterTool.class)
        .properties("spring.config.location:${config:null}")
        .properties("spring.profiles.active:" + Modules.REPLICATION)
        .properties("instance.home:${user.home}")
        .properties("instance.name:${source-catalog.name}_${replica-catalog.name}")
        .bannerMode(Mode.OFF)
        .registerShutdownHook(true)
        .build()
        .run(args));
  } catch (BeanCreationException e) {
    if (e.getMostSpecificCause() instanceof BindException) {
      printFilterToolHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
    }
    throw e;
  }
}
 
開發者ID:HotelsDotCom,項目名稱:circus-train,代碼行數:22,代碼來源:FilterTool.java

示例4: main

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  // below is output *before* logging is configured so will appear on console
  logVersionInfo();

  int exitCode = -1;
  try {
    SpringApplication application = new SpringApplicationBuilder(WaggleDance.class)
        .properties("spring.config.location:${server-config:null},${federation-config:null}")
        .properties("server.port:${endpoint.port:18000}")
        .registerShutdownHook(true)
        .build();
    exitCode = SpringApplication.exit(registerListeners(application).run(args));
  } catch (BeanCreationException e) {
    if (e.getMostSpecificCause() instanceof BindException) {
      printHelp(((BindException) e.getMostSpecificCause()).getAllErrors());
    }
    if (e.getMostSpecificCause() instanceof ConstraintViolationException) {
      logConstraintErrors(((ConstraintViolationException) e.getMostSpecificCause()));
    }
    throw e;
  }
  System.exit(exitCode);
}
 
開發者ID:HotelsDotCom,項目名稱:waggle-dance,代碼行數:24,代碼來源:WaggleDance.java

示例5: exit

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void exit(int rc) {
	if(ctx != null) {
		SpringApplication.exit(ctx, () -> rc);
	} else {
		System.exit(rc);
	}
}
 
開發者ID:edgexfoundry,項目名稱:device-modbus,代碼行數:8,代碼來源:Application.java

示例6: main

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    ApplicationContext context = SpringApplication.run(FreqTradeApplication.class, args);

    FreqTradeExchangeService exchangeService = context.getBean(FreqTradeExchangeService.class);
    AnalyzeService analyzeService = context.getBean(AnalyzeService.class);

    ZonedDateTime minimumDate = ZonedDateTime.now().minusHours(6);
    List<BittrexChartData> rawTickers = exchangeService.fetchRawticker(new CurrencyPair("ETH/BTC"), minimumDate);
    TimeSeries tickers = new BittrexDataConverter().parseRawTickers(rawTickers);
    boolean buySignal = analyzeService.getBuySignal(tickers);
    
    LOGGER.info("buy signal: {}", buySignal);
    
    SpringApplication.exit(context);
}
 
開發者ID:jeperon,項目名稱:freqtrade-java,代碼行數:16,代碼來源:AnalyzeServiceTester.java

示例7: exit

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void exit(int rc) {
  if (ctx != null) {
    SpringApplication.exit(ctx, () -> rc);
  } else {
    System.exit(rc);
  }
}
 
開發者ID:mgjeong,項目名稱:device-opcua-java,代碼行數:8,代碼來源:Application.java

示例8: main

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
    SpringApplication app = new SpringApplication(MessageServerApplication.class); 
    ApplicationContext applicationContext = app.run(args);
    
    try {
        applicationContext.getBean(MessageServerStarter.class).start(args);
    } catch (Exception e) {
        logger.error("Shutdown with errors ", e);
        SpringApplication.exit(applicationContext);
    } finally {
        logger.info("done");
    }
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:14,代碼來源:MessageServerApplication.java

示例9: shutdown

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
@AfterClass
public static void shutdown() {
	if (shutdownAfterRun) {
		logger.info("Stopping Data Flow Shell");
		if (dataFlowShell != null) {
			dataFlowShell.stop();
		}
		if (applicationContext != null) {
			logger.info("Stopping Data Flow Server");
			SpringApplication.exit(applicationContext);

			applicationContext = null;
		}
	}
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-dashboard,代碼行數:16,代碼來源:AbstractShellIntegrationTest.java

示例10: shutDown

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
/**
 * shutdown all threads and close the program
 */
private void shutDown() {
    try {
        SpringApplication.exit(applicationContext, () -> 0);

    } catch (IllegalArgumentException e) {
        System.out.println("il constesto è null, non si è avviato il server");
    }
    connectionManager.shutDown();
}
 
開發者ID:andrea9293,項目名稱:pcstatus,代碼行數:13,代碼來源:ServerBatteryMain.java

示例11: main

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args)
        throws InvalidTopologyException, AuthorizationException, AlreadyAliveException, InterruptedException {
    ConfigurableApplicationContext context = SpringApplication.run(DemoApplication.class, args);
    AppMain appMain = context.getBean(AppMain.class);
    appMain.Laugher();
    SpringApplication.exit(context);
}
 
開發者ID:Paleozoic,項目名稱:storm_spring_boot_demo,代碼行數:8,代碼來源:DemoApplication.java

示例12: handleSomethingHasFuckedUp

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
@Async
@Order(Ordered.LOWEST_PRECEDENCE)
@EventListener
void handleSomethingHasFuckedUp(final SomethingHasFuckedUpEvent event) {
    // We caught an unrecoverable exception in a thread, we better stop right now.
    logger.error("Event SomethingHasFuckedUpEvent caught.", event.getException());
    // Stop the application
    SpringApplication.exit(appContext, () -> 42);
}
 
開發者ID:anthonyraymond,項目名稱:joal,代碼行數:10,代碼來源:CoreEventListener.java

示例13: after

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
@Override
protected void after() {
	SpringApplication.exit(configurableApplicationContext);
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-skipper,代碼行數:5,代碼來源:LocalSkipperResource.java

示例14: main

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {

        ApplicationContext context = SpringApplication.run(FreqTradeApplication.class, args);

        FreqTradeExchangeService exchangeService = context.getBean(FreqTradeExchangeService.class);

        List<BittrexChartData> rawTickers = exchangeService.fetchRawticker(new CurrencyPair("ETH/BTC"));

        LOGGER.info("raw tickers: {}", rawTickers);

        ObjectMapper mapper = new ObjectMapper();

        String jsonAsString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(compact(rawTickers));

        Files.write(Paths.get("target", "ETH_BTC.json"), jsonAsString.getBytes(Charset.forName("UTF-8")));

        SpringApplication.exit(context);
    }
 
開發者ID:jeperon,項目名稱:freqtrade-java,代碼行數:19,代碼來源:GatherTestDataTester.java

示例15: stop

import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void stop(ConfigurableApplicationContext context) {
    SpringApplication.exit(context, () -> 0);
}
 
開發者ID:intuit,項目名稱:karate,代碼行數:4,代碼來源:TestService.java


注:本文中的org.springframework.boot.SpringApplication.exit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。