Skip to content

被代理方法参数含有primitive类型时,会抛出 java.lang.NoSuchMethodException #103

@light0x00

Description

@light0x00

image

如果被代理方法的参数有 primitive 类型,比如 int,args[k].getClass() 取出来是 java.lang.Integer ,之后执行 Method method = Class.forName(classType).getMethod(methodName, classes); 就会抛出 java.lang.NoSuchMethodException

这里正确的取被代理方法参数类型的方式应该是:

((MethodInvocationProceedingJoinPoint.MethodSignatureImpl) ((MethodInvocationProceedingJoinPoint) joinPoint).signature).getParameterTypes()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions