我正在使用 Spring 框架进行 Rest 服务。我下面有一个 Rest API,它具有 @PathVariable id。但是在 Proguard 混淆之后,参数 'id' 被更改为类似 'parama' 的内容,这导致 REST 无法工作,因为它与 @RequestMapping 中的定义不匹配。我该如何解决它以保留参数名称?
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public void getAccount(@PathVariable int id) {
...
}
最佳答案
-keepparameternames
将参数名称保留在公共(public)库方法的“LocalVariableTable”和“LocalVariableTypeTable”属性中。
这是我的混淆器配置:
-keepparameternames
-keepattributes SourceFile,LineNumberTable,*Annotation*
-keepclasseswithmembers class test.rest.controller.* {
public <methods>;
}
关于java - Proguard混淆后如何保留@PathVariable参数名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46103080/