wilton.beltre
wilton.beltre

Reputation: 21

AOP @Around does not work with JSF+Spring

I'm trying to intercept all call to JSF IUComponents, but this does not work:

@Pointcut("execution(* javax.faces.component.UIComponent+.encode*(..))")
   private void interceptor() { }

@Around("interceptor()")
public void aroundMethod(ProceedingJoinPoint joinPoint) {
   System.out.println("******** Hello from Interceptor Method! **********");
}

However, when I change the Pointcut, this works perfect:

@Pointcut("execution(* com.hsa.business.*.*(..))")
   private void interceptor() { }

@Around("interceptor()")
public void aroundMethod(ProceedingJoinPoint joinPoint) {
   System.out.println("******** Hello from Interceptor Method! **********");
}

This is my revealing information in xml:

<bean id="dummyAspect" class="com.hsa.security.aspectj.JSFComponentSecurityAspect" />
<aop:aspectj-autoproxy />

and:

<application>
 <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</elresolver>
</application>

Some help please ... ?

Upvotes: 1

Views: 553

Answers (1)

Ryan Stewart
Ryan Stewart

Reputation: 128949

I expect that you have no Spring beans of a type assignable to javax.faces.component.UIComponent in the same Spring context as the AOP auto-proxying and the aspect, hence the lack of anything happening. When Spring starts a context, it logs all the beans in the context at INFO level. Check for a context that has your "dummyAspect" in it, and see if the UI components are there, too.

Upvotes: 1

Related Questions