增强类
package com.example.springboot09.controller;
import com.sun.xml.internal.ws.org.objectweb.asm.ClassAdapter;
import com.sun.xml.internal.ws.org.objectweb.asm.ClassVisitor;
import com.sun.xml.internal.ws.org.objectweb.asm.MethodVisitor;
import com.sun.xml.internal.ws.org.objectweb.asm.Opcodes;
public class ASMClassModifyAdpter extends ClassAdapter {
public ASMClassModifyAdpter(ClassVisitor cv) {
super(cv);
}
@Override
public MethodVisitor visitMethod(final int access,
final String methodName,
final String desc,
final String signature,
final String[] exceptions) {
if ("display2".equals(methodName)) {
return null;//屏蔽了这个display2方法
}
if ("display1".equals(methodName)) {
MethodVisitor method