本文整理匯總了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;
}
}
示例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());
}
}
}
示例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;
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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");
}
}
示例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;
}
}
}
示例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();
}
示例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);
}
示例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);
}
示例13: after
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
@Override
protected void after() {
SpringApplication.exit(configurableApplicationContext);
}
示例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);
}
示例15: stop
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void stop(ConfigurableApplicationContext context) {
SpringApplication.exit(context, () -> 0);
}