I'm looking to instrument a Spring bean class(a class annotated with @RestController
for example),then making sure that the instrumented version of that class is used to create the application context.
I tried to look at the this thread which tries to load the context with a custom class loader. This looks like a viable approach but having less experience with dealing with class loaders, I'm still not sure how to make this work, do I just create my custom class loader and load my classes which are to be instrumented and then just set Spring's class loader as it's parent, so that it can load rest of the classes which I don't care to instrument?, or should I use Java agents for it?, is there any spring lifecycle annotation I can make use of?