---
title: "Spring DaoMethodAfterAdvice使用例子"
author: "javapub"
date: "2011-02-10T19:08:11Z"
tags: ["AOP", "Bean", "Java", "Spring"]
categories: ["企业架构"]
slug: "spring-daomethodafteradvice"
draft: false
lastmod: "2011-02-10T19:08:11Z"
id: 903089
url: "https://javapub.iteye.com/blog/903089"
---

该拦截器会在bean的方法执行后被执行 \[code="java"] import java.lang.reflect.Method; import org.springframework.aop.AfterReturningAdvice; public class DaoMethodAfterAdvice implements AfterReturningAdvice { public void afterReturning(Object arg0, Method arg1, Object\[] arg2, Object arg3) throws Throwable { System.out.println("\[DaoMethodAfterAdvice]:" + arg0 + " : " + arg2\[0]); } } \[/code] 配置文件 \[code="java"] beforeDaoAdvice afterDaoAdvice throwsDaoAdvice aroundAdvice \[/code] 完整代码见附件