1

我正在尝试在 Spring 托管的 JSF Bean 上应用 AOP,但由于某种原因,一旦我应用 AOP,JSF 就会抛出 MethodNotFoundException。

这是我的代码: Web.xml

<application>
<default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-kit-id>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>    
</application>

应用程序上下文.xml

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:security="http://www.springframework.org/schema/security"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:aop="http://www.springframework.org/schema/aop"
 xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="http://www.springframework.org/schema/beans    
 http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
 http://www.springframework.org/schema/aop  
 http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
 http://www.springframework.org/schema/tx  
 http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">

<aop:aspectj-autoproxy/>
 <bean id="loginAuditAspect" class="com.test.mobile.service.LoginAuditManagementAspect">
 <constructor-arg index="0">
<list>
<bean class="com.test.mobile.service.LoginAuditableResourceResolver" />
<bean class="com.test.mobile.service.LoggedInAuditableResourceResolver" />
<bean class="com.test.mobile.service.NavigationAuditableResourceResolver" />
</list>
</constructor-arg>
</bean>

   <bean id="loginService" class="com.test.mobile.service.MLoginServiceImpl" />  
   <bean id="memberService" class="com.test.mobile.service.MMemberServiceImpl" 
         scope="session">
    <property name="thpContext" ref="thpContext"></property>
    </bean> 

  <bean id="mMemberProfileBean" class="com.test.mobile.service.MMemberProfileBean" 
        scope="session">
  <property name="memberService" ref="memberService"></property>
  </bean>

  <bean id="testBean" class="com.test.mobile.service.TestBean" scope="session">
  </bean>
  </beans>

支持豆:

 public class TestBean extends BaseBackingBean {
   private static final long serialVersionUID = 1L; 

   @Auditable(resourceName="LoggedIn",      
 resourceResolverClass=com.test.mobile.service.LoggedInAuditableResourceResolver.class)
public String getXxx() {

    return null;
}

}

有人可以帮我在 Spring 管理的 JSF bean 上应用 AOP 逻辑吗

4

1 回答 1

0

您应该至少发布一些有关堆栈跟踪和方面的信息。但是,如果您正在丢失方法,只需应用 aspetct 尝试:

<aop:aspectj-autoproxy proxy-target-class="true"/>

它使用 CGLIB 来代理类而不是 jdk 代理(仅代理接口)。

于 2013-01-18T18:24:44.310 回答