public class ApolloApplicationContextInitializer extends Object implements org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>, org.springframework.boot.env.EnvironmentPostProcessor, org.springframework.core.Ordered
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.
| Modifier and Type | Field and Description |
|---|---|
static String[] |
APOLLO_SYSTEM_PROPERTIES |
static int |
DEFAULT_ORDER |
| Constructor and Description |
|---|
ApolloApplicationContextInitializer() |
| Modifier and Type | Method and Description |
|---|---|
int |
getOrder() |
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.
|
void |
setOrder(int order) |
public static final int DEFAULT_ORDER
public static final String[] APOLLO_SYSTEM_PROPERTIES
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 - public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void setOrder(int order)
Copyright © 2022 Ctrip, Inc.. All rights reserved.