Skip to content

Link building does not consider method parameters declared in interfaces #1189

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

Closed
krraghavan opened this issue Jan 26, 2020 · 3 comments
Closed
Assignees
Milestone

Comments

@krraghavan
Copy link

I generate all my Spring WebFlux methods in an interface from my Open API specification YAML file. The controller implements the methods in this interface. I also use WebFluxLinkBuilder to build my HATEOAS links in my returned response. However, unless the implementation has the @RequestParam/@PathVariable annotations, the generated links do not get resolved with the actual values. Ideally I shouldn't need to repeat what's in the interface in my implementation.

@gregturn
Copy link
Contributor

gregturn commented Feb 5, 2020

You have an interface with @RequestParam but not the implementation itself?

@gregturn
Copy link
Contributor

gregturn commented Feb 5, 2020

Makes sense given support for Spring Web itself in spring-projects/spring-framework#15682.

gregturn added a commit that referenced this issue Feb 7, 2020
When forming links, look at a controller class's interface definitions for possible Spring Web annotations.

Related issues: spring-projects/spring-framework#15682
gregturn added a commit that referenced this issue Feb 7, 2020
When forming links, look at a controller class's interface definitions for possible Spring Web annotations.

Related issues: spring-projects/spring-framework#15682
gregturn added a commit that referenced this issue Feb 7, 2020
When forming links, look at a controller class's interface definitions for possible Spring Web annotations.

Related issues: spring-projects/spring-framework#15682
gregturn added a commit that referenced this issue Feb 7, 2020
When forming links, look at a controller class's interface definitions for possible Spring Web annotations.

Related issues: spring-projects/spring-framework#15682
@gregturn gregturn changed the title WebFluxLinkBuilder does not resolve URI params declared in interfaces WebMvcLinkBuilder/WebFluxLinkBuilder does not resolve URI params declared in interfaces Feb 10, 2020
@gregturn
Copy link
Contributor

Expanded scope of this issue to Spring MVC.

odrotbohm pushed a commit that referenced this issue Feb 11, 2020
When forming links, look at a controller class's interface definitions for possible Spring Web annotations.

Related issues: spring-projects/spring-framework#15682
Original pull request: #1194.
odrotbohm added a commit that referenced this issue Feb 11, 2020
Switched to a less complicated implementation of the interface method parameter annotation lookup by using Spring's ClassUtils.getInterfaceMethodIfPossible(…).

Simplified test cases to pure unit test on the link builder APIs. We don't need to fully execute a complete MVC/WebFlux request/response cycle to verify the link creation to pick up the parameter annotations from the interfaces.

Original pull request: #1194.
@odrotbohm odrotbohm changed the title WebMvcLinkBuilder/WebFluxLinkBuilder does not resolve URI params declared in interfaces Link building does not consider method parameters declared in interfaces Feb 11, 2020
@odrotbohm odrotbohm self-assigned this Feb 11, 2020
@odrotbohm odrotbohm added this to the 1.1.0.M2 milestone Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants