SpringBoot实战教程-SpringBoot自动装配原理(spring.factories) 爱被打了一巴掌 2023-02-23 07:44 28阅读 0赞 **【订阅[专栏合集][Link 1],作者所有付费文章都能看(持续更新)】** **SpringBoot**在进行SpringApplication对象实例化时会通过Spring提供的SPI机制加载`META-INF/spring.factories`文件,根据配置的接口实现类名称,在程序中读取这些配置文件并实例化,加载到Spring容器中。 **spring.factories**文件位于自动配置模块: ![在这里插入图片描述][59c6518f4f024c4894614f538007e798.png] 有的时候我们需要提供一些SDK或者**Spring Boot** Starter给别人使用,这时我们就可以使用Factories机制。Factories机制可以让SDK或者Starter的使用者只需要很少甚至不需要进行配置,只需要在服务中引入我们提供的jar包即可完成自动装配。 ### 文章目录 ### * * 13.1 自定义Springboot Starter * * (1)创建功能接口 * (2)实现接口 * (3)创建自动装配配置 * (4)构建Springboot starter * [Link 1]: https://blog.csdn.net/hellozpc/category_11127579.html [59c6518f4f024c4894614f538007e798.png]: https://img-blog.csdnimg.cn/59c6518f4f024c4894614f538007e798.png
还没有评论,来说两句吧...