How Java retrieves method parameter names through reflection
Reference: http://blog.csdn.net/revitalizing/article/details/71036970
##Spring Implementation - Using Spring’s LocalVariableTableParameterNameDiscoverer
Spring MVC method parameter binding request path parameter
If an instance is injected through Spring instead of Class, and instance. getClass. getDeclaredMethod() is used, the parameter name cannot be obtained. During debugging, it can be seen that the method name has been proxied through JDK,
Unable to obtain parameter name
##Through the Parameter class in Java8
In versions prior to Java 8, when code was compiled into a class file, the type of method parameters was fixed, but the parameter names were lost, which is in stark contrast to dynamic languages that heavily rely on parameter names.
Now, Java 8 has started to preserve parameter names in class files, bringing great convenience to reflection. JDK8 has added the class Parameter
If the compilation level is below 1.8, the resulting parameter names are meaningless arg0, arg1… Unfortunately, the option to keep parameter names is turned on by the compilation switch javac parameters and is turned off by default.
Please note that this feature requires compiling the code into a 1.8 version class.