1.工厂加载机制
spring framework有一种工厂加载机制,即将实现类根据接口-实现类的关系放在配置文件中,然后一次获取指定接口的多个实例
使用时多个实例同时使用
2.spring.factories
在spring boot的源码目录下有这样一份文件:
spring-boot-source\spring-boot-project\spring-boot-autoconfigure\src\main\resources\META-INF\spring.factories
# Initializers
org.springframework.context.ApplicationContextInitializer=\
org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer,\
org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener
# Application Listeners
org.springframework.context.ApplicationListener=\
org.springframework.boot.autoconfigure.BackgroundPreinitializer
# Auto Configuration Import Listeners
org.springframework.boot.autoconf