Skip to content

Harden configuration property binding and improve exception handling#143

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

Harden configuration property binding and improve exception handling#143
mercyblitz merged 2 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x

Conversation

@mercyblitz

Copy link
Copy Markdown
Contributor

This pull request primarily refactors and improves the ConfigurationPropertiesBeanContext class in the microsphere-spring-boot-core module. The main focus is on cleaning up and reorganizing property value handling, enhancing error handling, and improving code readability and maintainability. It also updates the documentation to reflect the latest version numbers.

Refactoring and Code Organization

  • Refactored property value access and mutation logic in ConfigurationPropertiesBeanContext, consolidating and moving utility methods (like getPropertyValue, setPropertyValue, getInstance, and getFieldValue) to the end of the class, and improving their error handling with the ThrowableSupplier.execute utility. [1] [2] [3]
  • Removed duplicate or redundant methods, such as overloaded getPropertyValue and readFieldValue, and updated method calls to use the new structure. [1] [2] [3]
  • Renamed methods for clarity, e.g., setBean to initializeBean, and setPropertyValue to setProperty. [1] [2]

Error Handling and Logging

  • Improved error and exception handling in property access and mutation methods, adding more informative logging for trace and warning levels.

API and Behavior Changes

  • Changed how new property values are resolved and set, ensuring deep equality checks and proper cloning to avoid side effects. [1] [2]
  • Updated the logic for determining candidate properties and classes for binding, keeping the utility methods but moving them to the end of the class. [1] [2]

Documentation

  • Updated the version numbers for the main and 1.x branches in README.md to reflect the latest releases.

Minor Formatting

  • Minor formatting improvements, such as breaking up long interface implementation lines for readability.

github-actions Bot and others added 2 commits June 29, 2026 15:32
Refactors `ConfigurationPropertiesBeanContext` to separate bean initialization from property updates and centralize property get/set helpers with safer exception handling and cloning behavior. It also adds `ResolvableType` overloads for `BindUtils.getBindConstructor()` with guarded invocation logging, plus tests covering bean metadata, property read/write failures, and constructor-binding edge cases.
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.80460% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rties/bind/ConfigurationPropertiesBeanContext.java 93.58% 4 Missing and 1 partial ⚠️
...g/boot/context/properties/bind/util/BindUtils.java 57.14% 3 Missing ⚠️
Files with missing lines Coverage Δ Complexity Δ
...gurationPropertiesBeanPropertyChangedListener.java 92.00% <100.00%> (ø) 22.00 <1.00> (ø)
...g/boot/context/properties/bind/util/BindUtils.java 84.61% <57.14%> (-10.39%) 20.00 <4.00> (+3.00) ⬇️
...rties/bind/ConfigurationPropertiesBeanContext.java 85.28% <93.58%> (+1.79%) 80.00 <40.00> (+10.00)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mercyblitz mercyblitz merged commit f996d67 into microsphere-projects:release-1.x Jun 30, 2026
36 of 37 checks passed
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