Skip to content

Enhance configuration properties handling and update README#142

Merged
mercyblitz merged 12 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x
Jun 29, 2026
Merged

Enhance configuration properties handling and update README#142
mercyblitz merged 12 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x

Conversation

@mercyblitz

Copy link
Copy Markdown
Contributor

This pull request refactors and enhances the ConfigurationPropertiesBeanContext class, improving its encapsulation, property binding, and bean management. The changes introduce new utility methods, improve property value handling, and update the way beans and their properties are initialized and accessed. Additionally, the documentation is updated to reflect the latest versions.

Enhancements to ConfigurationPropertiesBeanContext:

  • Added new fields and utility methods for better encapsulation, including beanName, getBeanName(), getBeanType(), isConstructorBindingBean(), getPrefix(), and getBeanClass(). [1] [2]
  • Refactored bean initialization and property handling: initialization now retrieves the bean from the context if necessary, and property values are cloned for safety. [1] [2] [3] [4] [5]
  • Introduced methods to bind property values after binding (bindPropertyValues, bindPropertyValue), improving support for property updates.

Code cleanup and imports:

  • Updated and added several imports to support new features and refactored code. [1] [2]

Documentation updates:

  • Updated the README.md to reflect the latest released versions for both main and 1.x branches.

github-actions Bot and others added 7 commits June 27, 2026 13:31
Move the missing `ConfigurationPropertiesBeanContext` warning into `getConfigurationPropertiesBeanContext(...)` and add a null guard before `setProperty(...)` in `onFinish(...)`. This prevents potential NPEs when context creation returns null while keeping warning logs emitted from a single place.
Refresh the documented latest release versions for the `main` and `1.x` branches so the compatibility table matches the current published artifacts.
Reworks configuration properties bean context initialization to build contexts from bean definitions up front, track beans by name, and initialize property snapshots once singleton binding is complete. It also improves property value comparison by cloning/resolving bound values, handling constructor-bound beans more safely, and lazily resolving bean property names for clearer change events.
Use `RootBeanDefinition` with the shared `getResolvableType` helper when scanning configuration properties beans. This avoids relying on the generic bean definition API for merged definitions and makes bean type detection more reliable.
Add a compatible `org.springframework.boot.context.properties.ConstructorBinding` annotation in the compatibility module, and update configuration-properties tests to exercise constructor-bound beans with explicit constructor annotation and accessor methods. The listener test now also verifies `TestConstructorBindingConfigurationProperties` values, and an unused `isConstructorBindingBean()` helper was removed from `ConfigurationPropertiesBeanContext`.
Update `BindUtilsTest` to remove Spring Boot version-dependent expectations when checking `getBindConstructor` for `TestConstructorBindingConfigurationProperties`. The test now consistently asserts `null` in both cases, and drops the no-longer-used version and `assertEquals` imports.
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.70677% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rties/bind/ConfigurationPropertiesBeanContext.java 84.68% 13 Missing and 4 partials ⚠️
...ties/bind/ConfigurationPropertiesBeanProperty.java 0.00% 4 Missing ⚠️
...gurationPropertiesBeanPropertyChangedListener.java 88.88% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ Complexity Δ
...gurationPropertiesBeanPropertyChangedListener.java 92.00% <88.88%> (-0.19%) 22.00 <7.00> (-3.00)
...ties/bind/ConfigurationPropertiesBeanProperty.java 4.87% <0.00%> (+2.24%) 2.00 <0.00> (+1.00)
...rties/bind/ConfigurationPropertiesBeanContext.java 83.49% <84.68%> (-15.89%) 70.00 <33.00> (+8.00) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Adjust `bindPropertyValues()` to branch on `bindConstructor`: keep per-property binding for regular beans, but call `initBeanProperties()` when constructor binding is in use. This avoids applying field-style binding in constructor-bound scenarios and ensures properties are initialized through the constructor path.
Updates the Maven parent POM version in `pom.xml` from `0.3.4` to `0.3.5` to align this project with the latest microsphere-build configuration and dependency management.
Add a unit test covering `newConfigurationPropertiesBeanProperty` when given a `Bindable` created from an instance and no matching bean property metadata. This verifies the method returns `null` for that edge case.
Update the parent POM to use microsphere-spring 0.1.33.
Use the cached bind constructor when initializing bean properties, and reduce noisy property update logging from INFO to TRACE. The change also makes the trace output wording more consistent by referring to "Bean Property" throughout.
@mercyblitz mercyblitz merged commit c8a2e10 into microsphere-projects:release-1.x Jun 29, 2026
36 of 37 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant