How to configure ProGuard to respect Jackson model?

血红的双手。 提交于 2019-12-06 15:55:42

I have to admin that I simplified the example in my question. The solution to the problem was to keep getters and setters in ProGuard which I had to additionally define in model classes to make Jackson work.

-keep public class com.example.models.Product {
  public *** get*();
  public void set*(***);
} 

You can use @jsonProperty annotation

In many cases these classes already implement the Serializable interface. It could make sense to keep all those classes implementing this interface depending on your project. If so add this line to you proguard configuration.

-keep class * implements java.io.Serializable
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!