カスタム注釈の@Aroundアドバイスでアスペクトを書き込もうとしていますが、なぜ呼び出されないのかここ 私のコード:カスタム注釈のアスペクトが機能しない
@Aspect
@Component
public class AspectMeasureTime {
@Around(value = "execution(* com.beh.businesslayer..*(..)) && @annotation(measureTime)")
public void measureTime(ProceedingJoinPoint pjp, MeasureTime measureTime) throws Throwable {
/*some code*/
}
}
@Configuration
@ComponentScan(basePackages = {"com.beh"})
@EnableAspectJAutoProxy(proxyTargetClass = false)
public class WebConfig {
}
package com.beh.businesslayer.businessworkflows.pagefetcher;
public class PageFetcherWriter implements ItemWriter, StepExecutionListener {
@MeasureTime("timee")
private void printString(Object s) {
logger.info("entry = " + s);
}
}
package com.beh.businesslayer.businessworkflows.pagefetcher;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface MeasureTime {
String value();
}
私はこの注釈なしメイクジョインポイントを試したことだし、それが正常に動作します。 @ annotation(com.beh.businesslayer.businessworkflows.pagefetcher.MeasureTime)を試してみると、うまくいきませんでした。なぜ、どのように見えるべきか、何か考えていますか?
AspectJのコンパイル時に織っていますか?またはAspectJのロード時織りですか?または、AspectJはなく、Spring AOPのみですか? –
唯一のバウンドaop – Behemoth