diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationRunner.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationRunner.java index 08175746086..c07e6091ba7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationRunner.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2023 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. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/CommandLineRunner.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/CommandLineRunner.java index 855dd6d29a2..87fda64a689 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/CommandLineRunner.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/CommandLineRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2023 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. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index d31419c0c39..133db585581 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -670,11 +670,11 @@ class SpringApplicationTests { } @Test - void runFunctionalCommandLineRunnersAndApplicationRunners() { - SpringApplication application = new SpringApplication(FunctionalRunnerConfig.class); + void runCommandLineRunnersAndApplicationRunnersUsingOrderOnBeanDefinitions() { + SpringApplication application = new SpringApplication(BeanDefinitionOrderRunnerConfig.class); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("arg"); - FunctionalRunnerConfig config = this.context.getBean(FunctionalRunnerConfig.class); + BeanDefinitionOrderRunnerConfig config = this.context.getBean(BeanDefinitionOrderRunnerConfig.class); assertThat(config.runners).containsExactly("runnerA", "runnerB", "runnerC"); } @@ -1585,12 +1585,12 @@ class SpringApplicationTests { } @Configuration(proxyBeanMethods = false) - static class FunctionalRunnerConfig { + static class BeanDefinitionOrderRunnerConfig { - List runners = new ArrayList<>(); + private final List runners = new ArrayList<>(); @Bean - @Order // default is LOWEST_PRECEDENCE + @Order CommandLineRunner runnerC() { return (args) -> this.runners.add("runnerC"); }