Gra*_*mak 7 obfuscation spring proguard autowired
我正在使用Proguard来混淆具有多个@Autowired字段的库.混淆器正在重命名那些类字段(因为它们是类的私有/内部),因此我的bean无法实例化.
预混淆:
@Service
public class LicenseServiceImpl implements LicenseService {
@Autowired(required = false)
LicenseSessionStore licenseSessionStore;
@Autowired(required = false)
LicenseStore licenseStore;
...
}
Run Code Online (Sandbox Code Playgroud)
后期模糊处理:
@Service
public class LicenseServiceImpl implements LicenseService {
@Autowired(required=false)
LicenseSessionStore a;
@Autowired(required=false)
LicenseStore b;
...
}
Run Code Online (Sandbox Code Playgroud)
现在可能有很多方法可以使这些特定字段无法自动连接,但我希望找到的方法是告诉Proguard不要混淆任何带有重要Spring-isms注释的内部字段(@Autowired等) .
任何人都知道我一般如何做到这一点?
格兰特
我不认为这是对我的问题的正确答案,并且仍然希望有一个优雅的通用解决方案来解决这个问题。我发布的是我的临时解决方法,它让我以最暴力、最不优雅的方式解决了我的问题。
我通过将这些项目添加到 keepclassmembernames 选项中来明确排除这些项目的混淆:
<option>-keepclassmembernames class * {com.common.license.LicenseSessionStore licenseSessionStore; com.common.license.LicenseStore licenseStore; }</option>
Run Code Online (Sandbox Code Playgroud)
这不是一个首选的解决方案,因为它需要在每个类中进行特定的命名覆盖,并且将成为维护的噩梦。
仍然需要更好的答案!
授予
| 归档时间: |
|
| 查看次数: |
1859 次 |
| 最近记录: |