Class ConfigurationBeanBindingPostProcessor
java.lang.Object
io.microsphere.spring.beans.factory.annotation.ConfigurationBeanBindingPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.config.BeanPostProcessor
,org.springframework.core.Ordered
,org.springframework.core.PriorityOrdered
public class ConfigurationBeanBindingPostProcessor
extends Object
implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.BeanFactoryAware, org.springframework.core.PriorityOrdered
A
BeanPostProcessor
implementation that binds configuration beans with their corresponding properties.
This class processes beans annotated or registered as configuration beans, applying the relevant property values
during initialization. It also supports customization through a list of ConfigurationBeanCustomizer
instances,
which can modify the configuration beans after binding.
Example Usage
Basic Binding
@Component
public class MyConfig {
private String appName;
// Getters and setters
}
// In Spring configuration:
configurationProperties.put("appName", "MyApplication");
Customizing Configuration Beans
public class MyCustomizer implements ConfigurationBeanCustomizer {
@Override
public void customize(String beanName, Object bean) {
if (bean instanceof MyConfig) {
((MyConfig) bean).setAppName("CustomizedApp");
}
}
}
- Since:
- 1.0.0
- Author:
- Mercy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The bean name ofConfigurationBeanBindingPostProcessor
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet theList
ofConfigurationBeanCustomizers
int
getOrder()
postProcessAfterInitialization
(Object bean, String beanName) postProcessBeforeInitialization
(Object bean, String beanName) void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory) void
setConfigurationBeanBinder
(ConfigurationBeanBinder configurationBeanBinder) void
setConfigurationBeanCustomizers
(Collection<ConfigurationBeanCustomizer> configurationBeanCustomizers) void
setOrder
(int order) Set the order for current instance
-
Field Details
-
BEAN_NAME
The bean name ofConfigurationBeanBindingPostProcessor
- See Also:
-
-
Constructor Details
-
ConfigurationBeanBindingPostProcessor
public ConfigurationBeanBindingPostProcessor()
-
-
Method Details
-
postProcessBeforeInitialization
public Object postProcessBeforeInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException - Specified by:
postProcessBeforeInitialization
in interfaceorg.springframework.beans.factory.config.BeanPostProcessor
- Throws:
org.springframework.beans.BeansException
-
postProcessAfterInitialization
public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException - Specified by:
postProcessAfterInitialization
in interfaceorg.springframework.beans.factory.config.BeanPostProcessor
- Throws:
org.springframework.beans.BeansException
-
setOrder
public void setOrder(int order) Set the order for current instance- Parameters:
order
- the order
-
getConfigurationBeanBinder
-
setConfigurationBeanBinder
-
getConfigurationBeanCustomizers
Get theList
ofConfigurationBeanCustomizers
- Returns:
- non-null
- Since:
- 1.0.0
-
setConfigurationBeanCustomizers
public void setConfigurationBeanCustomizers(Collection<ConfigurationBeanCustomizer> configurationBeanCustomizers) -
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-