springMVC aop 拦截DAO方法 想在dao中的某个方法之前和之后做一些处理,发现不起作用。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?xml version="1.0" encoding="UTF-8" ?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" 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.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"><!-- <aop:aspectj-autoproxy proxy-target-class="true"/>--> <context:component-scan base-package="com.eta.dao"/> <context:component-scan base-package="com.eta.service"/> <!-- 打开aop 注解 --> <aop:aspectj-autoproxy />没有别的配置 <aop:config > <aop:aspect id="myListener" ref="TestAspect"> <aop:pointcut expression="execution(* com.dao.*.*(..))" id="listenerCut"/> <aop:around method="joinPointAccess" pointcut-ref="listenerCut"/> </aop:aspect> </aop:config>好奇怪 com.dao.*.*(..) 就可以出发切面方法,把dao改成别的目录就不触发了 你这样配置只是拦截com.dao.*下的类,而不会拦截它的子包下的类,如com.dao.impl.*如果想扫描com.dao下的所有包,应该这样表达式应该是execution(* com.dao..*.*(..)) jsp数据库 tomcat信息? hibernate多表查询问题 好久没来了,问个SQL语句,达人进。。。 100分>>>>>>>>>>>>>>>>>>>>>>>>>请教大家一SQL语句! 关于JSP的基本问题,知道的请回答,谢谢! 关于JSP页面在LINUX下运行的问题 成功安装Tomcat5后,Servlet应该放哪个目录? 怎么取一个字符串最右边的字符? 用forward在页面之间传参数,参数传不过去。代码是这样写的: OA 系统的菜单显示问题 Http post 文件到服务器
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
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.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<!-- <aop:aspectj-autoproxy proxy-target-class="true"/>--> <context:component-scan base-package="com.eta.dao"/>
<context:component-scan base-package="com.eta.service"/>
<!-- 打开aop 注解 -->
<aop:aspectj-autoproxy />
没有别的配置
<aop:aspect id="myListener" ref="TestAspect">
<aop:pointcut expression="execution(* com.dao.*.*(..))" id="listenerCut"/>
<aop:around method="joinPointAccess" pointcut-ref="listenerCut"/>
</aop:aspect>
</aop:config>
好奇怪 com.dao.*.*(..) 就可以出发切面方法,把dao改成别的目录就不触发了
如果想扫描com.dao下的所有包,应该这样表达式应该是execution(* com.dao..*.*(..))