标签:优先 ebe ring ebean servlet add app ntp rop
main:11, ServerApplication
run:1230, SpringApplication
run:1242, SpringApplication
run:297, SpringApplication
prepareEnvironment:338, SpringApplication
environmentPrepared:54, SpringApplicationRunListeners
environmentPrepared:74, EventPublishingRunListener
multicastEvent:127, SimpleApplicationEventMulticaster
multicastEvent:139, SimpleApplicationEventMulticaster
invokeListener:165, SimpleApplicationEventMulticaster
doInvokeListener:172, SimpleApplicationEventMulticaster
onApplicationEvent:171, ConfigFileApplicationListener
onApplicationEnvironmentPreparedEvent:185, ConfigFileApplicationListener
postProcessEnvironment:198, ConfigFileApplicationListener
addPropertySources:215, ConfigFileApplicationListener
load:343, ConfigFileApplicationListener$Loader
将下面2个自定义的文件解析并放入environment中。这里已经决定
application.properties
application-dev.properties
会有2次加载apollo默认的空间:
第一次:默认加载application
run:1230, SpringApplication
run:1242, SpringApplication
run:305, SpringApplication
prepareContext:364, SpringApplication
applyInitializers:628, SpringApplication
initialize:82, ApolloApplicationContextInitializer
initialize:103, ApolloApplicationContextInitializer
第二次:根据@EnableApolloConfig配置的值决定,如果没有值,默认加载application
run:1230, SpringApplication
run:1242, SpringApplication
run:307, SpringApplication
refreshContext:386, SpringApplication
refresh:754, SpringApplication
refresh:142, ServletWebServerApplicationContext
refresh:533, AbstractApplicationContext
invokeBeanFactoryPostProcessors:706, AbstractApplicationContext
invokeBeanFactoryPostProcessors:162, PostProcessorRegistrationDelegate
invokeBeanFactoryPostProcessors:282, PostProcessorRegistrationDelegate
postProcessBeanFactory:67, PropertySourcesProcessor
initializePropertySources:74, PropertySourcesProcessor
environment->propertySources中的propertySourceList集合元素的优先级来确定配置项,相同配置项取propertySourceList集合中在前面的一个。
apollo>application-dev.properties>application.properties>bootstrap.properties 这个优先级是指取值的优先级,不是文件加载的优先级
标签:优先 ebe ring ebean servlet add app ntp rop
原文地址:https://www.cnblogs.com/zt1991jskj/p/13177763.html