Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Ignore concrete classes in ImportHttpServices scanning - #37006

#37006
Open
karunsehwag wants to merge 1 commit into
spring-projects:mainspring-projects/spring-framework:mainfrom
karunsehwag:gh-36993-import-http-services-interface-onlykarunsehwag/spring-framework:gh-36993-import-http-services-interface-onlyCopy head branch name to clipboard
Open

Ignore concrete classes in ImportHttpServices scanning#37006
karunsehwag wants to merge 1 commit into
spring-projects:mainspring-projects/spring-framework:mainfrom
karunsehwag:gh-36993-import-http-services-interface-onlykarunsehwag/spring-framework:gh-36993-import-http-services-interface-onlyCopy head branch name to clipboard

Conversation

@karunsehwag

Copy link
Copy Markdown

Summary

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 IllegalArgumentException: [...] is not an interface.

Fix: isCandidateComponent() now also requires metadata.isInterface().

Fixes gh-36993

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 5, 2026
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>
@karunsehwag
karunsehwag force-pushed the gh-36993-import-http-services-interface-only branch from da21f1b to 79dbff9 Compare July 5, 2026 15:25

@yashmehla yashmehla left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImportHttpServices scans concrete classes implementing @HttpExchange interfaces

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.