Spring AOP で動作する Apache CXF JAX-RS サービスを取得しようとしています。簡単なロギング クラスを作成しました。
public class AOPLogger {
public void logBefore(){
System.out.println("Logging Before!");
}
}
私のSpring構成(beans.xml):
<aop:config>
<aop:aspect id="aopLogger" ref="test.aop.AOPLogger">
<aop:before method="logBefore" pointcut="execution(* test.rest.RestService.*(..))"/>
</aop:aspect>
</aop:config>
<bean id="aopLogger" class="test.aop.AOPLogger"/>
メソッド getServletRequest() が呼び出されると、RestService で常に NPE を取得します。
return messageContext.getHttpServletRequest();
aop 構成を削除するか、beans.xml からコメントアウトすると、すべて正常に動作します。
実際の Rest サービスはすべて、test.rest.RestService (クラス) を拡張し、getServletRequest() を呼び出します。CXF JAX-RS ドキュメントの例に基づいて、AOP を起動して実行しようとしています。私は何を間違っていますか?