-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Naming of @Selector params for custom Actuator endpoints requires class file method parameter embedding #11010
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
Comments
That's not the case anymore. You'll get an exception instead now. We still need to finalize the documentation of that infrastructure so we'll take that into account. That |
An actionable error message ought to be good enough. And, having the ability to specify request params would be great. I ended up creating two top-level endpoints as a workaround. In my usecase, I have Foo objects that can be looked-up by two different kinds of keys. |
Duplicates #10001 |
Uh oh!
There was an error while loading. Please reload this page.
Edit: This is based on testing against 2.0.0.M6.
Names of Actuator endpoint
@Selector
parameters are set based on their associated method parameter names. For this to work properly, endpoint classes must be compiled with these parameter names embedded (-parameters
javac param,<parameters>true</parameters>
in Maven, etc.). This happens by default if one's Spring Boot Maven project is defined withspring-boot-starter-parent
as its parent. But, if one isn't using this Maven configuration,@Selector
params end-up with names likearg0
, and the cause is non-obvious.Please consider:
Noting in the documentation for custom Actuator endpoints that embedded parameter names are required for custom naming.
Adding a
name
parameter to@Selector
that allows one to explicitly specify/override the parameter name.Note that I haven't looked into whether a default Gradle, etc. Spring Boot set-up results in compilation with embedded parameter names.
Also, even if one has his POM configured to compile with embedded parameter names, separate IDE configuration likely is required to turn this on when allowing an IDE to compile instead:
https://stackoverflow.com/questions/39217830/how-to-use-parameters-javac-option-in-intellij
The text was updated successfully, but these errors were encountered: