On Thursday, April 26, 2012 01:04:59 AM June Kobol wrote:
> Hi all:
>
> I got a problem when using aspectj with cxf 2.4.1. As
> follows, aopPointCuter cannot intercept accountService's interface. My
> spring is 2.5.6.
> Can aspectj be used with cxf?
You likely need to get the impl created from Spring as well. Something
like:
<bean id="aopPointCuter" class="aop.AopPointCuter">
<bean id="service" class="service.account.impl.AccountServiceImpl">
</bean>
<jaxws:endpoint id="accountService"
implementor="#service"
implementorClass="service.account.impl.AccountServiceImpl"
wsdlLocation="/WEB-INF/wsdl/AccountService.wsdl"
address="/AccountService"/>
That would allow spring to create the impl bean and apply the aspects and
such. CXF would just reference that bean directly.
Note the addition of the implementorClass attribute on jaxws:endpoint. With
the aspects, CXF may not be able to get the annotations and such from the
impl bean itself. By specifying the class, we can use that class object
directly to inspect for the annotations.
Dan
>
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> <bean
> class="org.springframework.beans.factory.annotation.AutowiredAnnotationBea
> nPostProcessor" />
> <aop:aspectj-autoproxy />
>
> <bean id="aopPointCuter" class="aop.AopPointCuter">
> </bean>
> <jaxws:endpoint id="accountService"
> implementor="service.account.impl.AccountServiceImpl"
> wsdlLocation="/WEB-INF/wsdl/AccountService.wsdl"
> address="/AccountService"> </jaxws:endpoint>
>
> @Aspect
> public class AopPointCuter implements Ordered {
>
> @Pointcut("execution(* service.account.AccountService..*(..))")
> public void accountService() {
> }
> @Around("( accountService())")
> public Object doSomething(ProceedingJoinPoint joinPoint)
> throws Throwable {
> .........
> }
> }
--
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com