{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/13261","repository_url":"https://api.github.com/repos/spring-projects/spring-boot","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/13261/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/13261/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/13261/events","html_url":"https://github.com/spring-projects/spring-boot/issues/13261","id":326463208,"number":13261,"title":"Custom actuator @Selector for web @ReadOperation requiring request parameter","user":{"login":"rLitto","id":8300410,"avatar_url":"https://avatars3.githubusercontent.com/u/8300410?v=4","gravatar_id":"","url":"https://api.github.com/users/rLitto","html_url":"https://github.com/rLitto","followers_url":"https://api.github.com/users/rLitto/followers","following_url":"https://api.github.com/users/rLitto/following{/other_user}","gists_url":"https://api.github.com/users/rLitto/gists{/gist_id}","starred_url":"https://api.github.com/users/rLitto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rLitto/subscriptions","organizations_url":"https://api.github.com/users/rLitto/orgs","repos_url":"https://api.github.com/users/rLitto/repos","events_url":"https://api.github.com/users/rLitto/events{/privacy}","received_events_url":"https://api.github.com/users/rLitto/received_events","type":"User","site_admin":false},"labels":[{"id":97741072,"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/status:%20waiting-for-feedback","name":"status: waiting-for-feedback","color":"fef2c0","default":false},{"id":293438798,"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/status:%20waiting-for-triage","name":"status: waiting-for-triage","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-25T10:13:21Z","updated_at":"2018-05-30T09:49:36Z","closed_at":null,"author_association":"NONE","body":"Version Spring Boot 2.0.2\r\nIssue: Custom Endpoint with `@ReadOperation` and `@Parameter`\r\nEnvironment: Gradle build with `-parameters` enabled\r\n\r\n```\r\n@Endpoint(id = \"custom\")\r\npublic class CustomEndpoint {\r\n    @ReadOperation\r\n    public CustomResponse getCustom() {\r\n      ...\r\n    }\r\n\r\n    @ReadOperation\r\n    public CustomResponse getCustomByName(@Selector String name) {\r\n...\r\n   }\r\n```\r\n\r\ncalling `http://localhost:62381/actuators` endpoint returns:\r\n\r\n```\r\n   \"custom\": {\r\n      \"href\": \"http://localhost:62381/actuator/custom\",\r\n      \"templated\": false\r\n    },\r\n    \"custom-arg0\": {\r\n      \"href\": \"http://localhost:62381/actuator/custom/{arg0}\",\r\n      \"templated\": true\r\n    },\r\n```\r\nbut calling `http://localhost:62381/actuator/custom/test` returns \r\n`There was an unexpected error (type=Bad Request, status=400).\r\nMissing parameters: name`\r\n\r\nthis is caused by `org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker validateRequiredParameters(InvocationContext context) ` validation failing\r\n\r\nCalling `http://localhost:62381/actuator/custom?name=test` returns the output of the first `@ReadOperation` not of the second\r\n\r\n\r\nThere is a workaround `http://localhost:62381/actuator/custom/ignored?name=test`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/393100783","html_url":"https://github.com/spring-projects/spring-boot/issues/13261#issuecomment-393100783","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/13261","id":393100783,"user":{"login":"LeBezout","id":16636436,"avatar_url":"https://avatars0.githubusercontent.com/u/16636436?v=4","gravatar_id":"","url":"https://api.github.com/users/LeBezout","html_url":"https://github.com/LeBezout","followers_url":"https://api.github.com/users/LeBezout/followers","following_url":"https://api.github.com/users/LeBezout/following{/other_user}","gists_url":"https://api.github.com/users/LeBezout/gists{/gist_id}","starred_url":"https://api.github.com/users/LeBezout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeBezout/subscriptions","organizations_url":"https://api.github.com/users/LeBezout/orgs","repos_url":"https://api.github.com/users/LeBezout/repos","events_url":"https://api.github.com/users/LeBezout/events{/privacy}","received_events_url":"https://api.github.com/users/LeBezout/received_events","type":"User","site_admin":false},"created_at":"2018-05-30T09:49:36Z","updated_at":"2018-05-30T09:49:36Z","author_association":"NONE","body":"Hi, i'm facing the same issue with Spring Boot 2.0.1 (maven + eclipse + tomcat + war deployment).\r\n\r\n```java\r\n@Component\r\n@Endpoint(id=\"my-custom\")\r\npublic class MyCustomEndpoint {\r\n  @ReadOperation\r\n  public Map<String, List<Parameter>> showParameters() {\r\n    // some code\r\n  }\r\n  @ReadOperation\r\n  public List<Parameter> showParametersByCategory(@Selector String category) {\r\n    // some code\r\n  }\r\n}\r\n```\r\n\r\n`Parameter` is a custom POJO\r\n\r\nWhen starting :\r\n```\r\n[...]o.s.b.a.e.web.servlet.WebMvcEndpointHandlerMapping|Mapped \"{[/actuator/my-custom],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}\" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)\r\n[...]|o.s.b.a.e.web.servlet.WebMvcEndpointHandlerMapping|Mapped \"{[/actuator/my-custom/{arg0}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}\" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)\r\n```\r\n\r\nMy \"selector\" method parameter named `category` becomes `arg0` and like @rLitto  :\r\n* i obtaint the error message `org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$BadOperationRequestException: Missing parameters: category` - here it is the good name\r\n* if i want to use the selector i must call the endpoint with the URI `/actuator/my-custom/foo?category=xxx`\r\n\r\nI've checked out the source code of  endpoints like `LoggersEndpoint` or `EnvironmentEndpoint` to compare to mine to understand what i did wrong...but in vain"}}
{"actor":{"display_login":"LeBezout"}}