Migrate CompositeHealth/HealthComponent to Spring Boot 4 descriptor types#1038
Merged
Merged
Conversation
…riptor types In Spring Boot 4 the actuator health response API was reorganised: the abstract `HealthComponent` was renamed to `HealthDescriptor` and its composite subtype `CompositeHealth` was renamed to `CompositeHealthDescriptor`, with both moving to `org.springframework.boot.health.actuate.endpoint`. The existing catch-all `ChangePackage` from `actuate.health` to `health.contributor` sent these to the wrong package and left the class names unchanged, leaving callers that do `instanceof CompositeHealth` or hold a `HealthComponent` returned by `HealthEndpoint.health()` failing to compile. Add explicit `ChangeType` entries before the catch-all, alongside the other `health.actuate.endpoint` renames.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's missing
In Spring Boot 4 the actuator health response API was reorganised:
org.springframework.boot.actuate.health.HealthComponent(abstract)org.springframework.boot.health.actuate.endpoint.HealthDescriptor(abstract)org.springframework.boot.actuate.health.CompositeHealthorg.springframework.boot.health.actuate.endpoint.CompositeHealthDescriptorHealthEndpoint.health()returnsHealthComponentHealthEndpoint.health()returnsHealthDescriptorMigrateToModularStartersalready handles every otherorg.springframework.boot.actuate.health.*type explicitly and then falls through to a catch-allChangePackagethat maps the remainder toorg.springframework.boot.health.contributor. That catch-all sentCompositeHealthandHealthComponentto the wrong package and didn't rename the classes, so callers like the one below still failed to compile under SB4:Change
Add two
ChangeTypeentries before the catch-allChangePackage, alongside the other types that move tohealth.actuate.endpoint:org.springframework.boot.actuate.health.CompositeHealth→org.springframework.boot.health.actuate.endpoint.CompositeHealthDescriptororg.springframework.boot.actuate.health.HealthComponent→org.springframework.boot.health.actuate.endpoint.HealthDescriptorgetComponents()exists onCompositeHealthDescriptorwith the same signature shape (returningMap<String, HealthDescriptor>), so the rest of the call site doesn't need touching.org.springframework.boot.actuate.health.Healthis unchanged — it still ends up atorg.springframework.boot.health.contributor.Healthvia the catch-all (it's the indicator output type, not aHealthDescriptor).Test plan
MigrateActuateHealthPackage#migrateCompositeHealthAndHealthComponentToDescriptorsexercises theinstanceof+getComponents()pattern from a real controllerMigrateToModularStartersTestpass locally