-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
SpringMvcContract does not support path parameters defined in interface's @RequestMapping annotation #1023
Comments
Using @RequestMapping on an interface level is not supported because of the way spring MVC works. It assumes they are real controllers. There is a path attribute on @FeignClient. |
Hmm, we're not using We're using the pattern defined in the documentation with one interface defining the resource and a controller implementing it and a client extending the interface in separate projects. AFAIK, using annotation on the interface worked properly when implementing it in our controller but I'll have to verify that with my colleague tomorrow. You're saying that this shouldn't work in the first place is that it? |
We're implementing the pattern defined here http://cloud.spring.io/spring-cloud-static/spring-cloud.html#spring-cloud-feign-inheritance It's working well having all the @RequestMapping annotations on the shared interface with the client extending the interface and the resource implementing the interface. The only thing not working is the support for query param on the class lever @RequestMapping annotation which this PR provides a fix. |
…pping This commit adds the support for query string defined in the class' @RequestMapping Annotation that is applied to all method of a controller. Fxies gh-1023, fixes gh-1024
In
SpringMvcContract
, the path defined in the interface's class@RequestMapping
annotation is prepended at the end of theparseAndValidateMetadata(Class<?> targetType, Method method)
method. While this works fine for most cases, it does not support path parameters defined there that apply to all methods. This is because thePathVariableParameterProcessor
expect it to be in theMethodMetadata
at the time or it adds it as a form param as a fallback.Example of a non working interface at the moment:
I'll submit a PR shortly! Thanks again for the great lib.
The text was updated successfully, but these errors were encountered: