I am trying to follow through example but not able to find a tangible one to help me understand how to trace all method calls and it's arguments within a particular method (based on elementMatcher)
The method I'd like to trace is getCustomer and intending to use ByteBuddy to get metadata of all methods called within getCustomer along with accessing all arguments passed to each method
eg. Would like to print out methods
i) customerRepository.findOne , with customerId value as argument
ii) log.info with customer value as argument
and so on ... with return value
public Customer getCustomer(@PathVariable("customerId") Long customerId) {
/* validate customer Id parameter */
if (null == customerId) {
throw new InvalidCustomerRequestException();
}
Customer customer = customerRepository.findOne(customerId);
if (null == customer) {
throw new CustomerNotFoundException();
}
log.info("Customer Data is {}", customer);
try {
dispatchEventToSalesForce(String.format(" Customer %s Logged into SalesForce", customer));
} catch (Exception e) {
log.error("Failed to Dispatch Event to SalesForce . Details {} ", e.getLocalizedMessage());
}
return customer;
}
Can someone please help me with Interceptor code snippet so that I can follow through as guidance