---
title: "A-O-P配置事务"
author: "kkllmey"
date: "2008-09-26T15:44:55Z"
tags: []
slug: "a-o-p"
draft: false
lastmod: "2008-09-26T15:44:55Z"
id: 247119
url: "https://ibc.iteye.com/blog/247119"
---

&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
&lt;beans  
 xmlns="[http://www.springframework.org/schema/beans](http://www.springframework.org/schema/beans) "  
 xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance) "  
 xmlns:aop="[http://www.springframework.org/schema/aop](http://www.springframework.org/schema/aop) "  
 xsi:schemaLocation="[http://www.springframework.org/schema/beans](http://www.springframework.org/schema/beans)  
 [http://www.springframework.org/schema/beans/spring-beans-2.0.xsd](http://www.springframework.org/schema/beans/spring-beans-2.0.xsd)  
 [http://www.springframework.org/schema/aop](http://www.springframework.org/schema/aop)  
 [http://www.springframework.org/schema/aop/spring-aop-2.0.xsd](http://www.springframework.org/schema/aop/spring-aop-2.0.xsd) "&gt;  
 &lt;!-- 配置通知Bean --&gt;  
 &lt;bean id="loggerBean" class="com.aptech.aop.LoggerBean" /&gt;  
 &lt;!-- 配置目标对象 --&gt;  
 &lt;bean id="aopBean" class="com.aptech.aop.AOPBean"/&gt;  
 &lt;aop:config&gt;  
  &lt;!-- 配置切入点 --&gt;  
  &lt;aop:pointcut id="loggerCalls" expression="execution(* com.aptech.aop.AOPBean.display(..))" /&gt;  
  &lt;!-- 配置切面 --&gt;  
  &lt;aop:aspect id="logAspect" ref="loggerBean"&gt;  
   &lt;!-- 配置环绕通知 --&gt;  
   &lt;aop:around pointcut-ref="loggerCalls" method="aroundLogCalls" /&gt;  
  &lt;/aop:aspect&gt;  
 &lt;/aop:config&gt;  
&lt;/beans&gt;