Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending abstract class does not expose parameter annotations #25788

Closed
couryrr opened this issue Sep 18, 2020 · 2 comments
Closed

Extending abstract class does not expose parameter annotations #25788

couryrr opened this issue Sep 18, 2020 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@couryrr
Copy link

couryrr commented Sep 18, 2020

I am on version 2.3.4.RELEASE and am seeing the same issue identified here #24127 except for abstract classes.

Here is the abstract class with the @RequestBody annotation:

image

Here is the extended class without the annotation:

image

Postman showing the data being sent in but returning nulls in the object:

image

If I move the @RequestBody annotation to the class that extends this works. Likewise if I make the abstract class an interface and do not provide the @RequestBody annotation it works as well.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 18, 2020
@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Nov 12, 2021
@snicoll
Copy link
Member

snicoll commented Nov 23, 2023

@couryrr sorry it took so long to look at this.

I can reproduce this behavior. Looking at org.springframework.web.method.HandlerMethod.HandlerMethodParameter, it creates its MethodParameter from the base class and I don't see what would be looking for the presence of metadata on the parent class. That's a bit at odds with method-level metadata that is indeed found.

@rstoyanchev wondering if that rings a bell?

@jhoeller jhoeller assigned jhoeller and unassigned rstoyanchev Jan 8, 2024
@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 8, 2024
@jhoeller jhoeller added this to the 6.1.3 milestone Jan 8, 2024
@jhoeller
Copy link
Contributor

jhoeller commented Jan 8, 2024

As a follow-up to #30801 in 6.1, our common AnnotatedMethod exposes annotations from base classes as well in 6.1.3 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants