2017-03-15 6 views
0

周囲のアドバイスを持つポイントカットを作成しようとしています:com.fasterxml.jackson.databind.DeserializationContext.reportMappingException()メソッド。Jackson DeserializationContextのAspectJポイントカット式reportMappingException

これは私がこれまで持っているものであり、それはすなわち達人働いていないが文句:

[WARNING] advice defined in com.charter.aesd.videocatalog.client.interceptor.ContactManagerLogger has not been applied [Xlint:adviceDidNotMatch] 
    /Users/rhasija/dev/projects/video/videocatalog-middle/client/src/main/java/com/charter/aesd/videocatalog/client/interceptor/ContactManagerLogger.java:36 

試験1:

@Pointcut("execution(* com.fasterxml.jackson.databind.DeserializationContext+.*(..))") 
public void servicePointcut() {} 

試験2:以下

@Pointcut("execution(* com.fasterxml.jackson.databind.*.*(..))") 
public void servicePointcut() {} 

は私のポンポンです.xml。 AspectJ経由で外部ライブラリへのポイントカットを行うことはできませんか?

<dependencies> 
    <dependency> 
     <groupId>org.aspectj</groupId> 
     <artifactId>aspectjrt</artifactId> 
    </dependency> 
    .... 
</dependencies> 

    <plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>aspectj-maven-plugin</artifactId> 
    <version>1.10</version> 
    <configuration> 
     <complianceLevel>1.8</complianceLevel> 
     <source>1.8</source> 
     <target>1.8</target> 
     <includes> 
      <include>**/*.java</include> 
      <include>**/*.groovy</include> 
     </includes> 
    </configuration> 
    <executions> 
     <execution> 
      <phase>compile</phase> 
      <goals> 
       <!--suppress MavenModelInspection --> 
       <goal>compile</goal> 
       <!--suppress MavenModelInspection --> 
       <goal>test-compile</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 
<plugin> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <version>2.1</version> 
    <configuration> 
     <descriptorRefs> 
      <descriptorRef>jar-with-dependencies</descriptorRef> 
     </descriptorRefs> 
     <archive> 
      <manifest> 
       <mainClass>info.ponge.julien.hacks.guiceaspectj.Main</mainClass> 
      </manifest> 
     </archive> 
    </configuration> 
    <executions> 
     <execution> 
      <phase>package</phase> 
      <goals> 
       <!--suppress MavenModelInspection --> 
       <goal>single</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 
+0

[最小、完全、および検証可能な例](http://stackoverflow.com/help/mcve)はどうですか?例えば、私はあなたの 'ContactManagerLogger'とJacksonを呼び出すコードではありません。 POMも不完全です。あなたは正しいジャクソン版を使用していますか?あなたが傍受したいメソッドは2.8以降しか利用できません。非常に多くの変数、私は激しく推測するのは好きではありません。 – kriegaex

答えて

0

mavenプラグインを設定しましたか?出力target/classesでそれらを

<configuration> 

    .... 

    <weaveDependencies> 
    <weaveDependency> 
     <groupId>com.fasterxml.jackson.core</groupId> 
     <artifactId>jackson-databind</artifactId> 
    </weaveDependency> 
    <weaveDependencies> 
<configuration> 

Weaving already compiled JAR artifacts

weaveDependenciesajc -inpathに対応し、熊何それがないことは、それらを、jarファイル内のクラスを取る波であることを念頭に置いて、そして、次のとおり追加します。

The AspectJ compiler/weaver

Maven aspectj:compile

あなたはクラスのロード時にバイトコードにアスペクト指示を注入するだけでなく、負荷時の織りを使用することができます。

関連する問題