Java8反射机制下获取方法名、参数名(配置-parameters)解决 注解拦截参数名发现参数名为 arg0 ... 的情况。
maven项目中添加如下配置
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> <compilerArgument>-parameters</compilerArgument> </configuration> </plugin>
其中 <compilerArgument>-parameters</compilerArgument> 可以保留参数原名