为了Spring在背后做了什么,我们来打印一下log。

application.properties文件添加如下

logging.level.org.springframework = debug

下面我们来看一下Log

2019-05-24 23:03:17.698  INFO 2041 --- [           main] con.demo.DemoApplication                 : Starting DemoApplication on JUNDONGdeMacBook-Pro.local with PID 2041 (/Users/jundongpei/resource/repo/Spring-tutorial/step_04/target/classes started by jundongpei in /Users/jundongpei/resource/repo/Spring-tutorial/step_04)
2019-05-24 23:03:17.698  INFO 2041 --- [           main] con.demo.DemoApplication                 : No active profile set, falling back to default profiles: default
2019-05-24 23:03:17.699 DEBUG 2041 --- [           main] o.s.boot.SpringApplication               : Loading source class con.demo.DemoApplication
2019-05-24 23:03:17.740 DEBUG 2041 --- [           main] o.s.b.c.c.ConfigFileApplicationListener  : Loaded config file 'file:/Users/jundongpei/resource/repo/Spring-tutorial/step_04/target/classes/application.properties' (classpath:/application.properties)
2019-05-24 23:03:17.741 DEBUG 2041 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.spring[email protected]1a052a00
2019-05-24 23:03:17.754 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
2019-05-24 23:03:17.768 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory'
2019-05-24 23:03:17.857 DEBUG 2041 --- [           main] o.s.c.a.ClassPathBeanDefinitionScanner   : Identified candidate component class: file [/Users/jundongpei/resource/repo/Spring-tutorial/step_04/target/classes/con/demo/BinarySearchImpl.class]
2019-05-24 23:03:17.858 DEBUG 2041 --- [           main] o.s.c.a.ClassPathBeanDefinitionScanner   : Identified candidate component class: file [/Users/jundongpei/resource/repo/Spring-tutorial/step_04/target/classes/con/demo/BubbleSortAlgorithm.class]
2019-05-24 23:03:17.978 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.condition.BeanTypeRegistry'
2019-05-24 23:03:18.085 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'propertySourcesPlaceholderConfigurer'
2019-05-24 23:03:18.091 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerProcessor'
2019-05-24 23:03:18.092 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata'
2019-05-24 23:03:18.092 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory'
2019-05-24 23:03:18.094 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
2019-05-24 23:03:18.095 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
2019-05-24 23:03:18.097 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor'
2019-05-24 23:03:18.102 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'demoApplication'
2019-05-24 23:03:18.106 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'binarySearchImpl'
2019-05-24 23:03:18.109 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'bubbleSortAlgorithm'
2019-05-24 23:03:18.110 DEBUG 2041 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Autowiring by type from bean name 'binarySearchImpl' via constructor to bean named 'bubbleSortAlgorithm'