On Mon September 28 2009 9:26:19 am HamletDRC wrote:
> Can someone confirm that Spring AOP before advice /should/ work with CXF?
>
> This is supported, correct?
Yes. This definitely SHOULD work and we've had several reports of people
using it, especially for things like spring security and such. Not sure what
would be going on.
Dan
>
> --
> Hamlet
>
> HamletDRC wrote:
> > Does anyone have any ideas about why my Spring AOP example doesn't work
> > with CXF? I've tried quite a few different approaches, this one seems the
> > simplest, but none worked.
> >
> > 1. I defined a service interface
> > 2. I defined a service implementation
> > 3. I defined a class to provide before method advice
> > 4. I declared the service in my cxf.xml
> > 5. I declared the aspect pointcut
> > 6. I ran tomcat and got this error: java.lang.IllegalStateException:
> > Post-processor tried to replace bean instance of type
> > [vue.tcsm.services.SystemParameterService] with (proxy) object of type
> > [$Proxy42] - not supported for aspect-configured classes!
> >
> >
> > 1. Service interface is simple:
> > @WebService(serviceName = "SystemParameterService")
> > public interface ISystemParameterService {
> > @WebMethod()
> > SystemParameterListDTO
> > getSystemParameter(@WebParam()SystemParameterListDTO requests);
> > }
> >
> > 2. Implementation is simple:
> >
> > @WebService(endpointInterface =
> > "vue.tcsm.services.ISystemParameterService")
> > public class SystemParameterService implements ISystemParameterService {
> > ...
> > }
> >
> > 3. Defined aop Pojo:
> >
> > public class ProxyExample {
> > public void beforeMethod() {
> > System.out.println("Before method call");
> > }
> >
> > 4. I declared the service in my cxf.xml
> >
> > <jaxws:endpoint id="systemParameter"
> > implementor="#systemParameterService"
> >
> > implementorClass="vue.tcsm.services.ISystemParameterService"
> > address="/SystemParameterService">
> > </jaxws:endpoint>
> > <bean id="systemParameterService"
> > class="vue.tcsm.services.SystemParameterService"/>
> > <bean id="profiler" class="vue.tcsm.interceptors.ProxyExample"/>
> >
> >
> > 5. I declared the aspect pointcut
> >
> > <aop:config>
> > <aop:aspect ref="profiler">
> > <aop:pointcut id="aopbeforeMethod"
> > expression="execution(*
> > vue.tcsm.services.ISystemParameterService.*(..))"/>
> > <aop:before pointcut-ref="aopbeforeMethod"
> > method="beforeMethod"/>
> > </aop:aspect>
> > </aop:config>
> >
> >
> > Any ideas on what could be wrong?
>
> -----
> --
> Hamlet D'Arcy
>
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog