2017-03-15 5 views
0

around advice 주위에 pointcut을 작성하려고합니다 : 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를 통해 외부 라이브러리에 대한 pointcut을 가질 수 없습니까?

<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 plugin 구성을 시도해 보셨습니까? 출력 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

당신은 클래스 로딩시 바이트 코드에 화면의 지시를 주입뿐만 아니라 직조로드 시간을 사용할 수 있습니다.