|
@@ -0,0 +1,33 @@
|
|
1
|
+package hello;
|
|
2
|
+
|
|
3
|
+import java.util.Arrays;
|
|
4
|
+
|
|
5
|
+import org.springframework.boot.CommandLineRunner;
|
|
6
|
+import org.springframework.boot.SpringApplication;
|
|
7
|
+import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
8
|
+import org.springframework.context.ApplicationContext;
|
|
9
|
+import org.springframework.context.annotation.Bean;
|
|
10
|
+
|
|
11
|
+@SpringBootApplication
|
|
12
|
+public class Application {
|
|
13
|
+
|
|
14
|
+ public static void main(String[] args) {
|
|
15
|
+ SpringApplication.run(Application.class, args);
|
|
16
|
+ }
|
|
17
|
+
|
|
18
|
+ @Bean
|
|
19
|
+ public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
|
20
|
+ return args -> {
|
|
21
|
+
|
|
22
|
+ System.out.println("Let's inspect the beans provided by Spring Boot:");
|
|
23
|
+
|
|
24
|
+ String[] beanNames = ctx.getBeanDefinitionNames();
|
|
25
|
+ Arrays.sort(beanNames);
|
|
26
|
+ for (String beanName : beanNames) {
|
|
27
|
+ System.out.println(beanName);
|
|
28
|
+ }
|
|
29
|
+
|
|
30
|
+ };
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+}
|