Support 'headless' applications

Update SpringApplication to run by default in 'headless' mode. This
prevents the AWT system from creating a Java icon (for example in the
OSX dock).

Also update builds to run tests in 'headless' mode.
This commit is contained in:
Phillip Webb
2014-01-13 22:41:17 -08:00
parent 0e413c3b48
commit e3b352e0b5
6 changed files with 63 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -90,6 +90,7 @@ public class SpringCli {
* @return a return status code (non boot is used to indicate an error)
*/
public int runAndHandleErrors(String... args) {
System.setProperty("java.awt.headless", Boolean.toString(true));
String[] argsWithoutDebugFlags = removeDebugFlags(args);
boolean debug = argsWithoutDebugFlags.length != args.length;
try {