Repository navigation
fix: Read composed, inherited and conditional Actuator web extensions as Boot discovers them (#655) - #691
Merged
Conversation
|
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.
Purpose
Boot decides which endpoint a web extension extends from the extension bean's type hierarchy with merged annotation values (
EndpointDiscoverer.ExtensionBean:MergedAnnotations.from(beanType, TYPE_HIERARCHY).get(EndpointExtension.class).getClass("endpoint")), and it only uses extension beans whose conditions match. The plugin readendpointfrom the extension class's own use-site annotation only and ignored the extension's bean condition, so composed, aliased and inherited extensions were dropped, and a disabled extension replaced the endpoint's operations. Items 5 and 3 of #655.Change
endpointis read through the merged resolver of fix: Read composed annotations as Spring merges them (#651) #673, rooted atEndpointExtension: a value fixed on a composed meta-annotation, an@AliasFortoEndpointWebExtension.endpoint(its default or a use-site value takes precedence over the meta value), and an@AliasForstraight toEndpointExtension.endpoint. An unaliased attribute namedendpointcounts only up to Spring Framework 6 (convention mapping), as in fix: Read composed annotations as Spring merges them (#651) #673.beanConditionbecomes undecided with the extension as carrier.Framework evidence
Real discovery on Boot 3.5.15 (Spring 6.2) and 4.1.0 (Spring 7.0), endpoints X and Y, the extension adds an operation:
@EndpointWebExtension(endpoint = X)@AliasFortoEndpointWebExtension.endpoint, default X, meta value Y@AliasFortoEndpointExtension.endpoint, default / use site Xendpoint()default X, meta value YNot in this PR
beanConditiondescription does not yet say that the carrier can be an extension (spring-ai wording, follow-up).Verification
beanConditionassertion.:spring-bootstrap:test --rerun-taskson 3ed4710, fresh JUnit XML): spring-core 2387, spring-web 937 (6 skipped), spring-ai 776, jpa 138, spring-data 140, base 35, aop 6, security 6, initializr 5; 0 failures, 0 errors.Main only:
ActuatorEndpointLoaderandMergedAnnotationAttributesare not on the release branches.Refs #655