{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/15230","repository_url":"https://api.github.com/repos/spring-projects/spring-boot","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/15230/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/15230/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/15230/events","html_url":"https://github.com/spring-projects/spring-boot/issues/15230","id":383310724,"node_id":"MDU6SXNzdWUzODMzMTA3MjQ=","number":15230,"title":"Add bean id to Actuator (mappings) JSON data for functional RMs","user":{"login":"BoykoAlex","id":6433390,"node_id":"MDQ6VXNlcjY0MzMzOTA=","avatar_url":"https://avatars1.githubusercontent.com/u/6433390?v=4","gravatar_id":"","url":"https://api.github.com/users/BoykoAlex","html_url":"https://github.com/BoykoAlex","followers_url":"https://api.github.com/users/BoykoAlex/followers","following_url":"https://api.github.com/users/BoykoAlex/following{/other_user}","gists_url":"https://api.github.com/users/BoykoAlex/gists{/gist_id}","starred_url":"https://api.github.com/users/BoykoAlex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BoykoAlex/subscriptions","organizations_url":"https://api.github.com/users/BoykoAlex/orgs","repos_url":"https://api.github.com/users/BoykoAlex/repos","events_url":"https://api.github.com/users/BoykoAlex/events{/privacy}","received_events_url":"https://api.github.com/users/BoykoAlex/received_events","type":"User","site_admin":false},"labels":[{"id":519291641,"node_id":"MDU6TGFiZWw1MTkyOTE2NDE=","url":"https://api.github.com/repos/spring-projects/spring-boot/labels/status:%20blocked","name":"status: blocked","color":"fef2c0","default":false},{"id":293438798,"node_id":"MDU6TGFiZWwyOTM0Mzg3OTg=","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":1,"created_at":"2018-11-21T22:17:01Z","updated_at":"2018-11-23T10:51:15Z","closed_at":null,"author_association":"NONE","body":"STS team attempts to find a spot in the source code that declares RM using functional style using the JSON data from the Actuator.\r\n\r\nSource code example:\r\n```\r\npublic class VetsRouter {\r\n\r\n\t@Bean\r\n\tpublic RouterFunction<ServerResponse> route(VetsHandler vetsHandler) {\r\n\r\n\t\treturn RouterFunctions\r\n\t\t\t.route(RequestPredicates.GET(\"/vets\").and(RequestPredicates.accept(MediaType.TEXT_PLAIN)), vetsHandler::vets)\r\n\t\t\t.andRoute(RequestPredicates.GET(\"/vets.html\"), vetsHandler::vetsHtml);\r\n\t}\r\n\t\r\n\t@Bean\r\n\tpublic RouterFunction<ServerResponse> moreRoute(VetsHandler vetsHandler) {\r\n\r\n\t\treturn RouterFunctions\r\n\t\t\t.route(RequestPredicates.GET(\"/new-vets\").and(RequestPredicates.accept(MediaType.TEXT_PLAIN)), vetsHandler::vets)\r\n\t\t\t.andRoute(RequestPredicates.GET(\"/new-vets.html\"), vetsHandler::vetsHtml);\r\n\t}\r\n}\r\n```\r\n\r\nThe JSON data from the Actuator for `/vets` route:\r\n```\r\n          {\r\n            \"predicate\": \"((GET && /vets) && Accept: [text/plain])\",\r\n            \"handler\": \"org.springframework.samples.petclinic.deviations.VetsRouter$$Lambda$868/443912630@369564bd\",\r\n            \"details\": {\r\n              \"handlerFunction\": {\r\n                \"className\": \"org.springframework.samples.petclinic.deviations.VetsRouter$$Lambda$868/443912630\"\r\n              }\r\n            }\r\n          },\r\n```\r\nThere are two pieces of data to help matching are __predicate__ and __handler__\r\nThe handler data should be most helpful in matching the proper place in the source. The matching place in the source code we think should be the `route` method declaration. Based on the handler's data we cannot match the `route` method unfortunately. The lambda with magic numbers is useless in this case.\r\n\r\nIt'd be great if the `details` object had something helpful to find the `route` method. Either method signature or perhaps the id of the corresponding `RouterFunction` bean. Seemed like getting the bean id into the JSON is doable (`ApplicationContext.getBeansOfType(RouterFunction.class, true, true)` gives an id -> bean object map, given a RouterFunction object should be easy to get the corresponding id ). Therefore the JSON would look like:\r\n```\r\n          {\r\n            \"predicate\": \"((GET && /vets) && Accept: [text/plain])\",\r\n            \"handler\": \"org.springframework.samples.petclinic.deviations.VetsRouter$$Lambda$868/443912630@369564bd\",\r\n            \"details\": {\r\n              \"handlerFunction\": {\r\n                \"className\": \"org.springframework.samples.petclinic.deviations.VetsRouter$$Lambda$868/443912630\"\r\n              },\r\n              \"bean\": \"route\"\r\n            }\r\n          },\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/441209730","html_url":"https://github.com/spring-projects/spring-boot/issues/15230#issuecomment-441209730","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/15230","id":441209730,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTIwOTczMA==","user":{"login":"bclozel","id":103264,"node_id":"MDQ6VXNlcjEwMzI2NA==","avatar_url":"https://avatars2.githubusercontent.com/u/103264?v=4","gravatar_id":"","url":"https://api.github.com/users/bclozel","html_url":"https://github.com/bclozel","followers_url":"https://api.github.com/users/bclozel/followers","following_url":"https://api.github.com/users/bclozel/following{/other_user}","gists_url":"https://api.github.com/users/bclozel/gists{/gist_id}","starred_url":"https://api.github.com/users/bclozel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bclozel/subscriptions","organizations_url":"https://api.github.com/users/bclozel/orgs","repos_url":"https://api.github.com/users/bclozel/repos","events_url":"https://api.github.com/users/bclozel/events{/privacy}","received_events_url":"https://api.github.com/users/bclozel/received_events","type":"User","site_admin":false},"created_at":"2018-11-23T10:51:15Z","updated_at":"2018-11-23T10:51:15Z","author_association":"MEMBER","body":"Spring Framework recently added `RequestPredicate` visitors in [SPR-17322](https://jira.spring.io/browse/SPR-17322). I don't know if that's enough to enable that support, we need to take a look at it first."}}
{"actor":{"display_login":"bclozel"}}