spring_AOP_XML
对于xml的AOP配置主要集中在配置文件中,所以只要设置好配置文件就行了
beans.xml
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<context:annotation-config />
<context:component-scan base-package="com.bjsxt"/> <bean id="logInterceptor" class="com.bjsxt.aop.LogInterceptor"></bean>
<aop:config>
<aop:pointcut expression="execution(public * com.bjsxt.service..*.add(..))" id="logService"/>
<aop:aspect id="logAspect" ref="logInterceptor">
<aop:before method="before" pointcut-ref="logService" />
</aop:aspect>
</aop:config>
</beans>
程序运行时先会查看aop:pointcut里面的expression,如果调用的方法在此里面,则调用相应的切面。
上面总括的意思为:程序在调用com.bjsxt.service包下面的add方法或子包等下面add方法(任意参数)时,先调用com.bjsxt.aop.LogInterceptor里面的before方法。
spring_AOP_XML的更多相关文章
随机推荐
- Confluence 6 发送 Confluence 通知到其他 Confluence 服务器
你可以配置 Confluence 服务器向其他的 Confluence 服务器发送消息.在这种情况下,Confluence 服务器将不会显示 workbox. 希望发送消息到其他 Confluence ...
- nginx实践(一)之静态资源web服务
静态资源服务场景CDN 配置语法-文件读取(nginx优势之一sendfile) 配置语法-tcp_nopush 简单的说就是把多个包合并,一次传输给客户端 配置语法-tap_nodelay 配置语法 ...
- selenium之实现多窗口切换到自己想要的窗口
#coding=utf-8 from selenium import webdriver import time from selenium.webdriver.support import expe ...
- redis-cluster集群搭建
Redis3.0版本之前,可以通过Redis Sentinel(哨兵)来实现高可用 ( HA ),从3.0版本之后,官方推出了Redis Cluster,它的主要用途是实现数据分片(Data Sha ...
- 按照勾选 删除表格的行<tr>
需求描述:有一个产品列表,有一个删减按钮,点击删减按钮,按照产品勾选的行,删除产品列表中对应的行数据 代码: //html代码<table id="table1"> & ...
- 【python】threadpool的内存占用问题
先说结论: 在使用多线程时,不要使用threadpool,应该使用threading, 尤其是数据量大的情况.因为threadpool会导致严重的内存占用问题! 对比threading和threadp ...
- Python基础之关于表达式
初识表达式: 优雅.清晰和务实是python的核心价值观,如果想通过操作和处理一个序列(或其他的可迭代对象)来创建一个新 的列表时可以使用列表解析(List comprehensions)和生成表达式 ...
- tail -f -n 0 /var/log/messages
<pre><font color="#CC0000"><b>root@kali</b></font>:<font ...
- CF1000G
蜜汁树形dp... 首先分析一下:他要求一条边至多只能经过两次,那么很容易会发现:从x到y这一条路径上的所有边都只会被经过一次.(如果过去再回来那么还要过去,这样就三次了,显然不合法) 那么其他能产生 ...
- PHP 方法,类与对象的相关函数学习
1.function_exists function_exists(string)检测函数是否存在,string表示需要检测的函数名称(注意与property_exists,method_exists ...