想各位大虾给个示例功能为:整个网站所有请求都被这个AOP切面拦截
在SPRING中  如何配置 可以拦截所有请求  包括Action,业务层的拦截
求教

解决方案 »

  1.   

    <!-- 配置事务 -->
    <!-- 事务管理实体 -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref bean="sessionFactory"/>
    </property>
    </bean>

    <!-- 事务配置 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
    <!-- 查询方法只读 -->
    <tx:method name="find*" propagation="REQUIRED" read-only="true"/>
    <!-- 其它方法使用普通事务 -->
    <tx:method name="insert*" propagation="REQUIRED" />
    <tx:method name="delete*" propagation="REQUIRED" />
    <tx:method name="update*" propagation="REQUIRED" />
    </tx:attributes>
    </tx:advice>

    <!-- aop切入 -->
    <aop:config>
    <!--  AspackJ语言 -->
    <aop:pointcut expression="execution(* com.svse.service.*.*(..))" id="interCut"/>
    <aop:advisor advice-ref="txAdvice" pointcut-ref="interCut"/>
    </aop:config>
      

  2.   

    你只用Spring,不用Struts2?
    Struts2有拦截器interceptor.