44import org .springframework .boot .CommandLineRunner ;
55import org .springframework .boot .SpringApplication ;
66import org .springframework .boot .autoconfigure .SpringBootApplication ;
7- import org .springframework .context .support .GenericApplicationContext ;
87
98@ SpringBootApplication
109public class Application implements CommandLineRunner {
1110
1211 /**
1312 * The main entry for the JVM.
14- * @param args
13+ * @param args
1514 */
16- public static void main (String ... args ) {
17- final SpringApplication springApplication = new SpringApplication (Application .class );
18- springApplication .addInitializers ((GenericApplicationContext ctx ) -> {
19- ctx .registerBean (Greeter .class , Greeter ::new );
20- });
21-
22- springApplication .run (args );
15+ public static void main (String ... args ) {
16+ SpringApplication .run (Application .class , args );
2317 }
24-
18+
2519 private final String greeting ;
26-
20+
2721 /** The dependency on an example service, injected via the constructor. */
2822 private final ExampleService exampleService ;
2923
3024 private final Greeter greeter ;
31-
25+
3226 public Application (
3327 @ Value ("${example.the-greeting:No greeting available}" ) final String greeting ,
3428 final ExampleService exampleService ,
@@ -42,9 +36,9 @@ public Application(
4236 /**
4337 * The entry point for running Spring Boot applications as command line applications.
4438 * Note that this isn't a static method like the {@link #main(java.lang.String...) }.
45- *
46- * @param args
47- * @throws Exception
39+ *
40+ * @param args
41+ * @throws Exception
4842 */
4943 @ Override
5044 public void run (String ... args ) throws Exception {
0 commit comments