proguard.cfg 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. -target 1.8 ##Specify the java version number
  2. -dontshrink ##Default is enabled, here the shrink is turned off, that is, the unused classes/members are not deleted.
  3. -dontoptimize ##Default is enabled, here to turn off bytecode level optimization
  4. -useuniqueclassmembernames ## Take a unique strategy for confusing the naming of class members
  5. -adaptclassstrings ## After confusing the class name, replace it with a place like Class.forName('className')
  6. -ignorewarnings
  7. -keepdirectories
  8. -keepclasseswithmembers public class * { public static void main(java.lang.String[]);} ##Maintain the class of the main method and its method name
  9. -keepclassmembers enum * { *; } ##Reserving enumeration members and methods
  10. -keepclassmembers class * {
  11. @org.springframework.beans.factory.annotation.Autowired *;
  12. @org.springframework.beans.factory.annotation.Qualifier *;
  13. @org.springframework.beans.factory.annotation.Value *;
  14. @org.springframework.beans.factory.annotation.Required *;
  15. @org.springframework.context.annotation.Bean *;
  16. @org.springframework.context.annotation.Primary *;
  17. @org.springframework.boot.context.properties.ConfigurationProperties *;
  18. @org.springframework.boot.context.properties.EnableConfigurationProperties *;
  19. @javax.annotation.PostConstruct *;
  20. @javax.annotation.PreDestroy *;
  21. }
  22. -keep @org.springframework.cache.annotation.EnableCaching class *
  23. -keep @org.springframework.context.annotation.Configuration class *
  24. -keep @org.springframework.boot.context.properties.ConfigurationProperties class *
  25. -keep @org.springframework.boot.autoconfigure.SpringBootApplication class *
  26. -allowaccessmodification
  27. -keepattributes *Annotation*
  28. -keepdirectories com.jayk.springboot.proguard.obfuscationdemo
  29. -keepdirectories org.springframework.boot.autoconfigure
  30. -keepclassmembers class * {
  31. *** get*();
  32. void set*(***);
  33. }
  34. -keepclassmembernames class * {
  35. java.lang.Class class$(java.lang.String);
  36. java.lang.Class class$(java.lang.String, boolean);
  37. }
  38. -keepclassmembers enum * {
  39. public static **[] values();
  40. public static ** valueOf(java.lang.String);
  41. public static ** fromValue(java.lang.String);
  42. }
  43. -keepnames class * implements java.io.Serializable
  44. -keepclassmembers class * implements java.io.Serializable {
  45. static final long serialVersionUID;
  46. private static final java.io.ObjectStreamField[] serialPersistentFields;
  47. !static !transient <fields>;
  48. !private <fields>;
  49. !private <methods>;
  50. private void writeObject(java.io.ObjectOutputStream);
  51. private void readObject(java.io.ObjectInputStream);
  52. java.lang.Object writeReplace();
  53. java.lang.Object readResolve();
  54. }
  55. -keepclassmembers class * {
  56. @org.springframework.beans.factory.annotation.Autowired <fields>;
  57. @org.springframework.beans.factory.annotation.Autowired <methods>;
  58. @org.springframework.security.access.prepost.PreAuthorize <methods>;
  59. }