简体   繁体   English

用于java.security.KeyStore的Spring AOP代理

[英]Spring AOP Proxy for java.security.KeyStore

I'm wondering is there any way to make a Spring AOP Proxy for the java.security.KeyStore , there are few obstacles here: 我想知道有什么方法可以为java.security.KeyStore制作Spring AOP代理,这里没有什么障碍:

  • KeyStore does not have default constructor KeyStore没有默认的构造函数
  • All methods of KeyStore are final KeyStore的所有方法都是最终的

I know that it is impossible to make a Spring AOP Proxy with the above constraints, but anyway I need to somehow count the method invocations of the KeyStore in the application. 我知道用上述约束制作Spring AOP代理是不可能的,但是无论如何我都需要以某种方式计算应用程序中KeyStore的方法调用。 Could anybody suggest some way to bypass the Spring AOP constraints or another way? 有人可以建议绕过Spring AOP约束的其他方法吗?

If you have control of the calling code - and hopefully you do because it is your own application you are talking about - and are willing to use full AspectJ (which does not need any proxies) instead of Spring-AOP, you cann use a call() pointcut instead of being limited to Spring-AOP's execution() pointcut. 如果您可以控制调用代码-并希望能够这样做,因为您正在谈论的是它自己的应用程序-并且愿意使用完整的AspectJ(不需要任何代理)代替Spring-AOP,则可以使用call()切入点,而不仅限于Spring-AOP的execution()切入点。 The pointcut would look something like this (untested, hacked from memory): 切入点看起来像这样(未经测试,从内存中被黑客入侵):

@Pointcut("call(* java.security.KeyStore.*(..))")

If you want to extend the pointcut to subclasses, add a + after the class name: 如果要将切入点扩展到子类,请在类名称后添加+

@Pointcut("call(* java.security.KeyStore+.*(..))")

You can even intercept constructor calls if they come from code you can weave into: 如果它们来自您可以编入的代码,您甚至可以拦截构造函数调用:

@Pointcut("call(java.security.KeyStore+.new(..))")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用java.security.KeyStore类存储和加载密钥 - How to store and load keys using java.security.KeyStore class JDK 1.6 与 IBM 1.5 上的 java.security.Keystore 别名 - java.security.Keystore aliases on JDK 1.6 vs IBM 1.5 java.security.KeyStore使用什么算法来加密KeyStore.setKeyEntry()和KeyStore.store()中的privateKey? - What algorithm does java.security.KeyStore use to encrypt the privateKey in KeyStore.setKeyEntry() and KeyStore.store()? 使用 java.security.KeyStore 将椭圆曲线证书和私钥导入 Java Keystore - Import elliptic curve Certificate and Private Key into Java Keystore using java.security.KeyStore 我们可以从带有密钥对和证书的 java.security.KeyStore 对象中提取一个特定的别名,然后注入到一个新的 java.security.KeyStore 对象中吗? - Can we extract a specific alias from a java.security.KeyStore object with its keypair and cert, then inject into a new java.security.KeyStore object? 使用BouncyCastle为java.security.Keystore生成自签名证书的简单方法 - Easy way to generate a self-signed certificate for java.security.Keystore using BouncyCastle 在java.security.KeyStore PKCS11中设置并获取DES密钥 - set and get DES key in java.security.KeyStore PKCS11 java.security.KeyStore在p12文件中仅显示两个证书之一 - java.security.KeyStore shows only one of two certs in a p12 file Spring AOP代理使用 - Spring AOP proxy use Spring AOP代理 - Spring AOP proxy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM