How to intercept all the classes in a project which has isolated classloaders
Hi, I am using ByteBuddy to create my SDK to monitor the business logic, the SDK will be a dependency in other applications. I have meet a problem that some application has isolated classloaders to load classes which cause the intercept failure. I know that is a classLoader issue but I don't know how to solve it.
The application has isolated classloaders like blow:

The SDK runs within the application(not a agent way), and the application has a container that load the platform classes with ContainerClassLoader, and the container has some service jars, each jar has a ServiceClassLoader to load the classes in the jar. The SDK classes is loaded by AppClassLoader or ContainerClassLoader.
My question is how to intercept all the classes in the Service jars in my SDK without IllegalAccessError.
That it was Advice is for, it inlines the code into the targeted class. You can the call out to a dispatcher, normally a class that is injected into the bootstrap loader.
If you look for my name on YouTube, I have introduced this solution in talks.
Thank you, I will now go search the content in YouTube. Can you give me the link where you talked the solution please?
Hi,I have searched something that you shared in YouTube
you suggest that use AgentBuilder.Transformer.ForAdvice to support System Classloader
but I have a more complex scene, I need to bind some customer annotations like blew:
How do I do that?
Provide it to the constructor.
I have no idea about 'Provide it to the constructor', can you please show me some code?
How to provide the parameters to com.my.interceptor.MyInterceptor ?
builder.visit(new AgentBuilder.Transformer.ForAdvice()
.include(MyPlugin.class.getClassLoader())
.advice(elementMatcher, "com.my.interceptor.MyInterceptor")
)
AgentBuilder.Transformer.ForAdvice(Advice.withCustomConfiguration());
Thank you I will try it.