Ignore concrete classes in ImportHttpServices scanning#37006
Open
karunsehwag wants to merge 1 commit into
Open
Ignore concrete classes in ImportHttpServices scanning#37006karunsehwag wants to merge 1 commit into
karunsehwag wants to merge 1 commit into
Conversation
AbstractHttpServiceRegistrar's classpath scanner uses AnnotationTypeFilter with considerInterfaces=true so that types can be discovered through an @HttpExchange-annotated interface. However, isCandidateComponent() did not verify that the discovered type itself was an interface. As a result, concrete classes implementing an @HttpExchange interface were also registered as HTTP service clients, causing proxy creation to fail later with "is not an interface". Closes spring-projectsgh-36993 Signed-off-by: Karun Choudhary <karunchoudhary2000@gmail.com>
da21f1b to
79dbff9
Compare
yashmehla
approved these changes
Jul 5, 2026
yashmehla
left a comment
There was a problem hiding this comment.
The change correctly restricts HTTP Service scanning to interfaces by checking metadata.isInterface() which prevents implementation classes from being registered as HTTP Service clients. The regression test using EchoAImpl verifies the reported scenario which ensures the intended interfaces are only registered. Looks good to me. Approved.
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.
Summary
AbstractHttpServiceRegistrar's classpath scanner usesAnnotationTypeFilterwithconsiderInterfaces=trueso that types can be discovered through an@HttpExchange-annotated interface. However,isCandidateComponent()did not verify that the discovered type itself was an interface.As a result, concrete classes implementing an
@HttpExchangeinterface were also registered as HTTP service clients, causing proxy creation to fail later withIllegalArgumentException: [...] is not an interface.Fix:
isCandidateComponent()now also requiresmetadata.isInterface().Fixes gh-36993