Skip to content

Update microsphere-spring-boot version and enhance feature utilities#138

Open
mercyblitz wants to merge 6 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x
Open

Update microsphere-spring-boot version and enhance feature utilities#138
mercyblitz wants to merge 6 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x

Conversation

@mercyblitz

Copy link
Copy Markdown
Contributor

This pull request refactors and improves the way Spring Cloud Client Actuator features are registered and configured via properties. The main changes include introducing a new strongly-typed configuration properties class, extracting utility methods, and updating the property structure for clarity and maintainability.

Key improvements:

  • The configuration property structure for registering features is now more explicit and type-safe, using a dedicated FeaturesProperties class.
  • Utility methods for feature property and bean name generation have been moved to a new FeaturesUtils class.
  • The property format for abstract and named features is changed for better clarity.
  • The code for registering features has been simplified and made more robust.

Configuration property and structure improvements

  • Introduced a new FeaturesProperties class annotated with @ConfigurationProperties, providing explicit, type-safe access to abstract and named feature definitions in configuration files. This replaces manual parsing of environment properties and supports better validation and IDE support.
  • Changed the property format for defining features: abstract features now use the prefix microsphere.spring.cloud.features.abstract.<module>, and named features use microsphere.spring.cloud.features.named.<module>.<feature>, replacing the previous flat structure.

Codebase simplification and maintainability

  • Extracted all utility methods for property name and bean name generation (such as getAbstractFeaturePropertyName, getNamedFeaturePropertyName, etc.) into a new FeaturesUtils utility class, improving code reuse and clarity.
  • Refactored ConfigurationPropertyHasFeaturesAutoConfiguration to use the new FeaturesProperties class and utility methods, removed legacy property parsing logic, and improved feature registration logic for better maintainability and correctness. [1] [2] [3]

Internal data structure improvements

  • Changed the internal collections for holding features from List to Set (specifically, LinkedHashSet and TreeSet) to avoid duplicates and ensure predictable ordering when registering features.

github-actions Bot and others added 6 commits June 19, 2026 02:30
Update microsphere-spring-boot.version in the parent POM from 0.1.22 to 0.1.23 to pick up the latest framework fixes and improvements.
Update microsphere-spring-boot.version in parent POM from 0.1.23 to 0.1.24. This increments the BOM version used across modules to pick up the latest microsphere Spring Boot fixes and improvements.
Add typed configuration binding and helpers for feature registration: FeaturesProperties, FeaturesUtils, NamedFeatureComparator, and FeaturesConstants. Refactor ConfigurationPropertyHasFeaturesAutoConfiguration to use @EnableConfigurationProperties, inject FeaturesProperties, detect bean types, and register HasFeatures via DefaultListableBeanFactory; switch internal collections to Sets and adapt conversion to lists for HasFeatures. Add default features.yaml and unit tests to cover constants, utils, and auto-configuration behavior.
Change the qualified feature name format from "microsphere.{module}.{feature}" to "{module}:{feature}". FeaturesUtils now imports and uses COLON_CHAR and removes the MICROSPHERE_PROPERTY_NAME_PREFIX/DOT_CHAR usage. Updated the unit test expectation in FeaturesUtilsTest to match the new "web:rest-template" format.
Adjust test expectations in ConfigurationPropertyHasFeaturesAutoConfigurationTest to use the new feature naming format. The assertions now expect prefixed short names ("web:WebClient" and "rest:RestTemplate") instead of the previous fully-qualified class names, reflecting a refactor of NamedFeature naming. No functional behavior changed aside from the test assertions.
@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