springboot源码略读
springboot的精髓是自动依赖注入。那么哪些能自动注入呢,打开spring-boot-autoconfigure,jar下的spring.factories。
可以看到一堆这样的配置:
# Auto Configure org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,\ org.springframework.boot.autoconfigure.aop.AopAutoConfiguration,\ org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\ org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\ org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\
让我们随便点开一个文件,AopAutoConfiguration,

这里的就能看到我们能写在配置文件里的配置。
真正的加载原理在
SpringApplication.class这个类中,位于第138的run方法中,
createApplicationContext()这个方法进行加载。
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
