Class ConfigurationChangeDetector
java.lang.Object
org.springframework.cloud.kubernetes.commons.config.reload.ConfigurationChangeDetector
- Direct Known Subclasses:
PollingConfigMapChangeDetector,PollingSecretsChangeDetector
This is the superclass of all beans that can listen to changes in the configuration and
fire a reload.
- Author:
- Nicola Ferraro
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.core.env.ConfigurableEnvironmentprotected org.apache.commons.logging.Logprotected ConfigReloadPropertiesprotected ConfigurationUpdateStrategy -
Constructor Summary
ConstructorsConstructorDescriptionConfigurationChangeDetector(org.springframework.core.env.ConfigurableEnvironment environment, ConfigReloadProperties properties, ConfigurationUpdateStrategy strategy) -
Method Summary
Modifier and TypeMethodDescriptionbooleanchanged(List<? extends org.springframework.core.env.MapPropertySource> left, List<? extends org.springframework.core.env.MapPropertySource> right) booleanchanged(org.springframework.core.env.MapPropertySource left, org.springframework.core.env.MapPropertySource right) Determines if two property sources are different.protected <S extends org.springframework.core.env.PropertySource<?>>
SfindPropertySource(Class<S> sourceClass) Finds one registered property source of the given type, logging a warning if multiple property sources of that type are available.<S extends org.springframework.core.env.PropertySource<?>>
List<S>findPropertySources(Class<S> sourceClass) protected List<org.springframework.core.env.MapPropertySource>locateMapPropertySources(org.springframework.cloud.bootstrap.config.PropertySourceLocator propertySourceLocator, org.springframework.core.env.Environment environment) Returns a list of MapPropertySource that correspond to the current state of the system.void
-
Field Details
-
log
protected org.apache.commons.logging.Log log -
environment
protected org.springframework.core.env.ConfigurableEnvironment environment -
properties
-
strategy
-
-
Constructor Details
-
ConfigurationChangeDetector
public ConfigurationChangeDetector(org.springframework.core.env.ConfigurableEnvironment environment, ConfigReloadProperties properties, ConfigurationUpdateStrategy strategy)
-
-
Method Details
-
reloadProperties
public void reloadProperties() -
changed
public boolean changed(org.springframework.core.env.MapPropertySource left, org.springframework.core.env.MapPropertySource right) Determines if two property sources are different.- Parameters:
left- left map property sourcesright- right map property sources- Returns:
trueif source has changed
-
changed
-
findPropertySource
protected <S extends org.springframework.core.env.PropertySource<?>> S findPropertySource(Class<S> sourceClass) Finds one registered property source of the given type, logging a warning if multiple property sources of that type are available.- Type Parameters:
S- property source type- Parameters:
sourceClass- class for which property sources will be searched for- Returns:
- matched property source
-
findPropertySources
public <S extends org.springframework.core.env.PropertySource<?>> List<S> findPropertySources(Class<S> sourceClass) - Type Parameters:
S- property source type- Parameters:
sourceClass- class for which property sources will be found- Returns:
- finds all registered property sources of the given type
-
locateMapPropertySources
protected List<org.springframework.core.env.MapPropertySource> locateMapPropertySources(org.springframework.cloud.bootstrap.config.PropertySourceLocator propertySourceLocator, org.springframework.core.env.Environment environment) Returns a list of MapPropertySource that correspond to the current state of the system. This only handles the PropertySource objects that are returned.- Parameters:
propertySourceLocator- Spring's property source locatorenvironment- Spring environment- Returns:
- a list of MapPropertySource that correspond to the current state of the system
-