code manipulation : 바이트 코드 변경하기(javaagent)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package org.example;
|
||||
|
||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||
import net.bytebuddy.implementation.FixedValue;
|
||||
import net.bytebuddy.matcher.ElementMatchers;
|
||||
|
||||
import java.lang.instrument.Instrumentation;
|
||||
|
||||
public class MasulsaAgent {
|
||||
|
||||
public static void premain(String agentArgs, Instrumentation inst) {
|
||||
new AgentBuilder.Default()
|
||||
.type(ElementMatchers.any())
|
||||
.transform((builder, typeDescription, classLoader, javaModule) -> builder.method(ElementMatchers.named("pullOut")).intercept(FixedValue.value("Rabbit!!"))).installOn(inst);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user