InvalidPropertyException:bean类的属性'myListName [0]'无效

时间:2017-01-23 15:47:11

标签: java spring proguard thymeleaf obfuscation

在使用Thymeleaf运行Spring MVC Web应用程序并使用Proguard进行模糊处理时,我遇到了以下异常:

org.springframework.web.util.NestedServletException: 
Request processing failed; nested exception is 
org.springframework.beans.InvalidPropertyException: 
Invalid property 'listOfSomething[0]' of bean class ...

这在混淆之前工作正常,但之后会中断。

public class FormToSubmit {

    private List<MyType> listOfSomething;

    public List<MyType> getListOfSomething() {
        return listOfSomething;
    }

    public void setListOfSomething(List<MyType> listOfSomething) {
        this.listOfSomething = listOfSomething;
    }
}

在使用以下proguard行期间,我已经在混淆期间保留了所有公共属性访问器:

-keep public class com.package.name.model.** { *; }

1 个答案:

答案 0 :(得分:0)

事实证明,proguard正在删除列表的类型参数。将以下行添加到proguard配置解决了该问题。

-keepattributes Signature