【问题标题】:AOP @Around does not work with JSF+SpringAOP @Around 不适用于 JSF+Spring
【发布时间】:2011-07-26 22:48:34
【问题描述】:

我正在尝试拦截对 JSF IUComponents 的所有调用,但这不起作用:

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

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

但是,当我更改切入点时,这很完美:

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

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

这是我在 xml 中的揭示信息:

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

和:

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

请帮忙...?

【问题讨论】:

    标签: java spring jsf jsf-2


    【解决方案1】:

    我希望您在与 AOP 自动代理和方面相同的 Spring 上下文中没有可分配给 javax.faces.component.UIComponent 类型的 Spring bean,因此不会发生任何事情。当 Spring 启动一个上下文时,它会在 INFO 级别记录上下文中的所有 bean。检查包含“dummyAspect”的上下文,并查看 UI 组件是否也存在。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-18
      • 1970-01-01
      • 1970-01-01
      • 2021-12-27
      • 2020-09-29
      • 1970-01-01
      • 2010-10-02
      • 1970-01-01
      相关资源
      最近更新 更多