Spring-SpringFactoriesLoader
SpringFactoriesLoader
- 
Author: HuiFer 
- 
源码阅读仓库: SourceHot-spring-boot 
- 
全路径 : org.springframework.core.io.support.SpringFactoriesLoader
- 
测试类 : org.springframework.core.io.support.SpringFactoriesLoaderTests
loadFactories
- 加载并实例化工厂
|  |  | 
loadSpringFactories
- 获取接口的实现类名
|  |  | 
- 
存放在 测试目录下的 META-INF/spring.factories1 2 3 4 5 6 7 8 9org.springframework.core.io.support.DummyFactory =\ org.springframework.core.io.support.MyDummyFactory2, \ org.springframework.core.io.support.MyDummyFactory1 java.lang.String=\ org.springframework.core.io.support.MyDummyFactory1 org.springframework.core.io.support.DummyPackagePrivateFactory=\ org.springframework.core.io.support.DummyPackagePrivateFactory
- 
Enumeration<URL> urls变量存放的是 扫描到的META-INF/spring.factories路径
- 
while 代码简单描述 - 获取文件路径
- 文件路径解析
- 读取文件 Properties 解析
- 放入返回结果
- 放入缓存
 
instantiateFactory
|  |  | 
- 反射创建
- 原文作者:知识铺
- 原文链接:https://geek.zshipu.com/post/code/docs/Spring/clazz/Spring-SpringFactoriesLoader/
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。
- 免责声明:本页面内容均来源于站内编辑发布,部分信息来源互联网,并不意味着本站赞同其观点或者证实其内容的真实性,如涉及版权等问题,请立即联系客服进行更改或删除,保证您的合法权益。转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。也可以邮件至 sblig@126.com
 
                
             
                
            