Apache CXF REST Services w/ Spring AOP -
I am trying to work with Apache CXF jacks-RS services with Spring AOP. I have created a simple logging class:
public class AOPLogger {public void logBefore () {System.out.println ("first logging!"); }}
My Spring Configuration (Beans. Xml):
& lt; Aop: config & gt; & Lt; Aop: aspect id = "aoplogger" ref = "test.aop.AOPLogger" & gt; & Lt; Aop: method = "logBefore" pointcut = "execution (* test.rest.RestService. * (..))" /> & Lt; / Aop: Aspect & gt; & Lt; / Aop: config & gt; & Lt; Bean id = "Appleogger" category = "test.aop.AOPLogger" />
I always get calls in RestService to get a service when the call is called for getServletRequest (), in which:
return MessageContacts .getHttpServletRequest ();
If I remove an app configuration or my beans Commenting on XML, everything works fine.
All my real rest services are tested. Test.rest.RestService (which is a class) and call getServletRequest () I am just trying to run and run AOP on the basis of example in CXF JX-RS documentation. Does anybody have any idea what I am doing wrong? Thanks!
You just need to apply some simple interface to your resource class with a method
@ Contact Wide Set Message Contex (Message Contax Mark) {}
This will enable CXF Spring App Helper to search for method
Comments
Post a Comment