Skip to content

Naming of @Selector params for custom Actuator endpoints requires class file method parameter embedding  #11010

@shabino

Description

@shabino

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 with spring-boot-starter-parent as its parent. But, if one isn't using this Maven configuration, @Selector params end-up with names like arg0, and the cause is non-obvious.

Please consider:

  1. Noting in the documentation for custom Actuator endpoints that embedded parameter names are required for custom naming.

  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions