Skip to content

io microsphere spring beans factory annotation ConfigurationBeanBindingPostProcessor

github-actions[bot] edited this page Jun 18, 2026 · 18 revisions

ConfigurationBeanBindingPostProcessor

Type: Class | Module: microsphere-spring-context | Package: io.microsphere.spring.beans.factory.annotation | Since: 1.0.0

Source: microsphere-spring-context/src/main/java/io/microsphere/spring/beans/factory/annotation/ConfigurationBeanBindingPostProcessor.java

Overview

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

{@code

### Declaration

```java
public class ConfigurationBeanBindingPostProcessor implements BeanPostProcessor, BeanFactoryAware, PriorityOrdered
```

**Author:** Mercy

## Version Information

- **Introduced in:** `1.0.0`
- **Current Project Version:** `0.2.27-SNAPSHOT`

## Version Compatibility

This component is tested and compatible with the following Java versions:

| Java Version | Status |
|:---:|:---:|
| Java 17 | ✅ Compatible |
| Java 21 | ✅ Compatible |
| Java 25 | ✅ Compatible |

## Examples

### Example 1

```java
@Component
public class MyConfig {
    private String appName;

    // Getters and setters
}

// In Spring configuration:
configurationProperties.put("appName", "MyApplication");
```

### Example 2

```java
public class MyCustomizer implements ConfigurationBeanCustomizer {
    @Override
    public void customize(String beanName, Object bean) {
        if (bean instanceof MyConfig) {
            ((MyConfig) bean).setAppName("CustomizedApp");
        }
    }
}
```

## Usage

### Maven Dependency

Add the following dependency to your `pom.xml`:

```xml

    io.github.microsphere-projects
    microsphere-spring-context
    ${microsphere-spring.version}

```

> **Tip:** Use the BOM (`microsphere-spring-dependencies`) for consistent version management. See the [Getting Started](https://github.com/microsphere-projects/microsphere-spring#getting-started) guide.

### Import

```java
import io.microsphere.spring.beans.factory.annotation.ConfigurationBeanBindingPostProcessor;
```

## API Reference

### Public Methods

| Method | Description |
|--------|-------------|
| `setOrder` | The bean name of `ConfigurationBeanBindingPostProcessor` |
| `getConfigurationBeanBinder` |  |
| `setConfigurationBeanBinder` |  |
| `getConfigurationBeanCustomizers` | Get the `List` of `ConfigurationBeanCustomizer ConfigurationBeanCustomizers` |
| `setConfigurationBeanCustomizers` |  |
| `setBeanFactory` |  |
| `getOrder` |  |

### Method Details

#### `setOrder`

```java
public void setOrder(int order)
```

The bean name of `ConfigurationBeanBindingPostProcessor`
/
public static final String BEAN_NAME = "configurationBeanBindingPostProcessor";

static final String CONFIGURATION_PROPERTIES_ATTRIBUTE_NAME = "configurationProperties";

static final String IGNORE_UNKNOWN_FIELDS_ATTRIBUTE_NAME = "ignoreUnknownFields";

static final String IGNORE_INVALID_FIELDS_ATTRIBUTE_NAME = "ignoreInvalidFields";

private final Logger logger = getLogger(getClass());

private ConfigurableListableBeanFactory beanFactory = null;

private ConfigurationBeanBinder configurationBeanBinder = null;

private List configurationBeanCustomizers = null;

private int order = LOWEST_PRECEDENCE;

#### `getConfigurationBeanCustomizers`

```java
public List getConfigurationBeanCustomizers()
```

Get the `List` of `ConfigurationBeanCustomizer ConfigurationBeanCustomizers`

*Since: 1.0.0*

---

*This documentation was auto-generated from the source code of [microsphere-spring](https://github.com/microsphere-projects/microsphere-spring).*

Home

spring-context

spring-guice

spring-jdbc

spring-test

spring-web

spring-webflux

spring-webmvc

Clone this wiki locally