public class ApolloApplicationContextInitializer extends Object implements org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>, org.springframework.boot.env.EnvironmentPostProcessor
Configuration example:
# set app.id app.id = 100004458 # enable apollo bootstrap config and inject 'application' namespace in bootstrap phase apollo.bootstrap.enabled = trueor
# set app.id app.id = 100004458 # enable apollo bootstrap config apollo.bootstrap.enabled = true # will inject 'application' and 'FX.apollo' namespaces in bootstrap phase apollo.bootstrap.namespaces = application,FX.apolloIf you want to load Apollo configurations even before Logging System Initialization Phase, add
# set apollo.bootstrap.eagerLoad.enabled apollo.bootstrap.eagerLoad.enabled = trueThis would be very helpful when your logging configurations is set by Apollo. for example, you have defined logback-spring.xml in your project, and you want to inject some attributes into logback-spring.xml.
| Constructor and Description |
|---|
ApolloApplicationContextInitializer() |
| Modifier and Type | Method and Description |
|---|---|
void |
initialize(org.springframework.context.ConfigurableApplicationContext context) |
void |
postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment configurableEnvironment,
org.springframework.boot.SpringApplication springApplication)
In order to load Apollo configurations as early as even before Spring loading logging system phase,
this EnvironmentPostProcessor can be called Just After ConfigFileApplicationListener has succeeded.
|
public void initialize(org.springframework.context.ConfigurableApplicationContext context)
initialize in interface org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment configurableEnvironment,
org.springframework.boot.SpringApplication springApplication)
postProcessEnvironment in interface org.springframework.boot.env.EnvironmentPostProcessorconfigurableEnvironment - springApplication - Copyright © 2018 Ctrip, Inc.. All rights reserved.