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

Add documentation/exception for required java compiler flag "parameters" #2337

Open
kaszuster opened this issue Mar 1, 2024 · 0 comments
Open

Comments

@kaszuster
Copy link

When using OpenFeign in the following way (no name attribute specified):

@RequestLine("GET /getSomething?id={id}")
String getSomething(@Param String id);

You may encounter the following exception:

... annotation was empty on param 0

This happens because @Param long catalogId is compiled as @Param long arg0. OpenFeign will then fail to read the parameter name via reflection.

To fix this, you need to pass the parameters flag to the Java compiler:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <parameters>true</parameters>
    </configuration>
</plugin>

After hours of research and debugging I have found this solution. Just now I found a little hint in your documentation: (if the code was compiled with -parameters flag). I would like to see that more visible or even in the exception..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant