public class EnvironmentInitializer extends Object implements org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent>, org.springframework.core.Ordered
先初始化日志,再初始化configcenter配置。原因: 1、先初始化日志的优点:初始化configcenter配置报错时,能打印日志;缺点:在configcenter中的日志相关的部分配置不会生效。 2、先初始化configcenter配置的优点:在configcenter中的日志相关配置会生效;缺点:初始化configcenter配置报错时,无法打印日志。 总结:一般日志需要进行动态化的配置比较少(比如:日志格式、日志文件路径等),所以默认设置为先初始化日志再初始化configcenter配置。
| 限定符和类型 | 类和说明 |
|---|---|
static class |
EnvironmentInitializer.ConfigcenterPropertySource
configcenter配置资源
|
| 构造器和说明 |
|---|
EnvironmentInitializer() |
public void onApplicationEvent(org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent event)
onApplicationEvent 在接口中 org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent>public int getOrder()
getOrder 在接口中 org.springframework.core.OrderedCopyright © 2020. All rights reserved.