Spring と MongoDB Java ドライバーを使用しており、mongo DBCursor オブジェクトのすべての呼び出しをインターセプトして、クエリが実行される前に表示しようとしています。
外部jar用のaspject-maven-pluginを使用してこれを実行しようとしています。
http://mojo.codehaus.org/aspectj-maven-plugin/weaveJars.html
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<verbose>true</verbose>
<privateScope>true</privateScope>
<complianceLevel>1.5</complianceLevel>
<weaveDependencies>
<weaveDependency>
<groupId>org.mongodb</groupId>
<artifactId>>mongo-java-driver</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
私はすでにSpring AOPを使用しており、Javaコードでaspecjを構成しています
@EnableAspectJAutoProxy
次に、@Aspect アノテーションを使用するクラスに以下を追加します。(他のインターセプトは、私のプロジェクトのソース コードにあるカスタム クラスで正常に動作しています)
@Pointcut("execution(* com.mongodb.DBCursor..*.*(..))")
public void interceptAndLog(ProceedingJoinPoint invocation){
_loggingService.Info("intercepted DBCursor");
}
@Pointcut を @Before に置き換えてみましたが、どちらも機能しません。
前もって感謝します、
ローナン