-
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
Feign bug when use @RequestParam but not have value #1482
Comments
Spring Cloud Feign supports simple and map request parameter. related issue: #1097 |
@lowzj so if the |
@ryanjbaxter I'm sorry for my unclear description. For examples:
|
@lowzj and this is also the same behavior as Spring MVC? It sounds like @924060929 is saying it is not the same behavior. |
@ryanjbaxter @lowzj Sorry, forgot to show my code. Feign client interface code:
Program throw exception when startup:
|
I think I understand the problem better now. Correct me if I am wrong... It seems like Spring MVC allows you to specify query parameters in a |
Yes, that's what you said |
If that is the case maybe you can open an issue in OpenFeign to see if this is something they can help support. I don't really see a way to change the behavior from our side. Maybe in Feign they can do something similar to Spring MVC so that if the method signature contains basic types it takes the parameters and converts them to a Map with keys being the parameter names. |
@924060929 I guess that you're using java8 to compile your code. Java8 has a different way to preserve method parameter names and make them available at runtime by using javac compiler argument more information may be helpful: |
The jar is spring-cloud-netflix-core-1.2.2.RELEASE-sources.jar
In the code org\springframework\cloud\netflix\feign\annotation\RequestParamParameterProcessor.java, the method "processArgument" treat @RequestParam param as Map when the value is empty, but in spring mvc, when @RequestParam's value is null, reflect the field name as the value. This diffrent action can make misunderstand.
As follows:
Please fix it, :)
The text was updated successfully, but these errors were encountered: