intercept jdk
Hello, author, I want to intercept classes in JDK. First, I need to inject the interceptor into the boot class loader. What can I do next? Can you give me some suggestions or provide some ideas.Thank you very much.It's best to have examples
Can classes in JDK intercept construction methods?
Yes, you can intercept constructors just as methods with minor limitations. By default, Byte Buddy ignores all JDK types. You need to define a custom ignore matcher on your agent builder. Note that this will impact performance and you should try to exclude as many JDK packages as possible.
@raphw Should the classes referenced by the interceptor also be injected into the boot class loader?
yes, all types referenced by the code that you want to run in the interceptor should be accessible and available for the boot class loader because of the JRE classloading strategy