We'd like to find for /vets and /vets.html routes the method:
public RouterFunction<ServerResponse> route(...)
There are two pieces of data to help find the method: predicate and handler.
The handler data should be the most helpful in matching the method. However, based on the handler data we cannot match the route() method unfortunately. The lambda with magic numbers is useless in this case.
It'd be great if each router function could hold the id of the RouterFunction bean for example or expose the RouterFunction bean id in the RouterFunctions.Visitor such that instead of
Down the stream Boot Actuator could pick that bean id and pass it down to JMX bean data for the functional RM. Thus we on the STS side could find the method defining bean with the id and then associate that place in the source code to a place where functional RM is defined.
Otherwise, currently actuator has an aggregate RouterFuctions object that has all RMs and extracts predicates and handlers for each RM from the aggregate RouterFuctions object with a help of RouterFunctions.Visitor
The vast majority of RouterFunction in a given WebFlux.fn app are not Spring Beans. In your example, the only RouterFunction bean is the one created in route. This router bean is composed of two other routes (to vets and vetsHtml), but these are not registered as Spring beans. Having just one or perhaps two RouterFunction beans is quite typical. Additionally, there is a way to run WebFlux.fn outside of an application context (see the reference docs), in which case none of the router functions are Spring beans.
Given that most router functions are not Spring beans, we are not going to change the visitor API to take a bean identifier, as it would be null for most routes. However, it is quite easy to get the bean id yourself in your visitor, if you still want to. All you need in your RouterFunctions.Visitor implementation is a reference to the app context, find all RouterFunction beans in said context, and do a simple object equality comparison (==) against them in the route method to get to the bean id.