Class ConfigurationPropertiesRebinder
- java.lang.Object
-
- org.springframework.cloud.context.properties.ConfigurationPropertiesRebinder
-
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<EnvironmentChangeEvent>
@Component @ManagedResource public class ConfigurationPropertiesRebinder extends Object implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<EnvironmentChangeEvent>
Listens forEnvironmentChangeEventand rebinds beans that were bound to theEnvironmentusing. When these beans are re-bound and re-initialized, the changes are available immediately to any component that is using the@ConfigurationProperties@ConfigurationPropertiesbean.- Author:
- Dave Syer
- See Also:
for a deeper and optionally more focused refresh of bean components.
-
-
Constructor Summary
Constructors Constructor Description ConfigurationPropertiesRebinder(ConfigurationPropertiesBeans beans)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getBeanNames()Map<String,Exception>getErrors()A map of bean name to errors when instantiating the bean.Set<String>getNeverRefreshable()voidonApplicationEvent(EnvironmentChangeEvent event)voidrebind()booleanrebind(Class type)WARNING: This method rebinds beans from any context in the hierarchy using the main application context.booleanrebind(String name)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
-
-
Constructor Detail
-
ConfigurationPropertiesRebinder
public ConfigurationPropertiesRebinder(ConfigurationPropertiesBeans beans)
-
-
Method Detail
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
getErrors
public Map<String,Exception> getErrors()
A map of bean name to errors when instantiating the bean.- Returns:
- The errors accumulated since the latest destroy.
-
rebind
@ManagedOperation public void rebind()
-
rebind
@ManagedOperation public boolean rebind(String name)
-
rebind
public boolean rebind(Class type)
WARNING: This method rebinds beans from any context in the hierarchy using the main application context.- Parameters:
type- bean type to rebind.- Returns:
- true, if successful.
-
onApplicationEvent
public void onApplicationEvent(EnvironmentChangeEvent event)
- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<EnvironmentChangeEvent>
-
-