diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index 669df6b31ef..a8032313343 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -162,7 +162,7 @@ public class SpringApplication { private List> initializers; - private String[] defaultCommandLineArgs; + private String[] defaultArgs; /** * Crate a new {@link SpringApplication} instance. The application context will load @@ -312,10 +312,10 @@ public class SpringApplication { */ protected void addPropertySources(ConfigurableEnvironment environment, String[] args) { if (this.addCommandLineProperties) { - if (this.defaultCommandLineArgs != null) { + if (this.defaultArgs != null) { environment.getPropertySources().addFirst( new SimpleCommandLinePropertySource("defaultCommandLineArgs", - this.defaultCommandLineArgs)); + this.defaultArgs)); } environment.getPropertySources().addFirst( new SimpleCommandLinePropertySource(args)); @@ -543,13 +543,13 @@ public class SpringApplication { } /** - * Set default command line arguments which will be used in addition to those - * specified to the {@code run} methods. Default arguments can always be overridden by - * user defined arguments.. - * @param defaultCommandLineArgs the default command line args to set + * Set default arguments which will be used in addition to those specified to the + * {@code run} methods. Default arguments can always be overridden by user defined + * arguments.. + * @param defaultArgs the default args to set */ - public void setDefaultCommandLineArgs(String... defaultCommandLineArgs) { - this.defaultCommandLineArgs = defaultCommandLineArgs; + public void setDefaultArgs(String... defaultArgs) { + this.defaultArgs = defaultArgs; } /** diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index b8769692d40..0951d1f32c5 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -315,7 +315,7 @@ public class SpringApplicationTests { @Test public void defaultCommandLineArgs() throws Exception { SpringApplication application = new SpringApplication(ExampleConfig.class); - application.setDefaultCommandLineArgs("--baz", "--bar=spam", "bucket"); + application.setDefaultArgs("--baz", "--bar=spam", "bucket"); application.setWebEnvironment(false); this.context = application.run("--bar=foo", "bucket", "crap"); assertThat(this.context, instanceOf(AnnotationConfigApplicationContext.class));