Class ConfigServerBootstrapApplicationListener
- java.lang.Object
-
- org.springframework.cloud.config.server.bootstrap.ConfigServerBootstrapApplicationListener
-
- All Implemented Interfaces:
EventListener,org.springframework.boot.env.EnvironmentPostProcessor,org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent>,org.springframework.core.Ordered
public class ConfigServerBootstrapApplicationListener extends Object implements org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent>, org.springframework.boot.env.EnvironmentPostProcessor, org.springframework.core.Ordered
Normally you don't want the config server to be a config client itself, so this listener disables the config client unlessspring.cloud.config.enabledis explicitly "true". It has to be "true" at the time this listener is fired, which means before thebootstrap.ymlis parsed, which in turn means to you need to launch the application with an existing primedEnvironment(e.g. via System properties or aSpringApplicationBuilder). This is the same rule of precedence as for anything else affecting the bootstrap process itself, e.g. settingspring.cloud.bootstrap.nameto something other than "bootstrap".N.B. a config server can always be an "embedded" config client (using its own config repository as a property source) if you set
spring.cloud.config.server.bootstrap=trueinbootstrap.yml. This listener is only to prevent it from using HTTP to contact itself.- Author:
- Dave Syer, Ryan Baxter
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_ORDERDefault order of the bootstrap application listener.
-
Constructor Summary
Constructors Constructor Description ConfigServerBootstrapApplicationListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetOrder()voidonApplicationEvent(org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent event)voidpostProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application)voidsetOrder(int order)
-
-
-
Field Detail
-
DEFAULT_ORDER
public static final int DEFAULT_ORDER
Default order of the bootstrap application listener.- See Also:
- Constant Field Values
-
-
Method Detail
-
postProcessEnvironment
public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application)- Specified by:
postProcessEnvironmentin interfaceorg.springframework.boot.env.EnvironmentPostProcessor
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
setOrder
public void setOrder(int order)
-
onApplicationEvent
public void onApplicationEvent(org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent event)
- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent>
-
-