2005-11-01
Spring AOP
关键字: aop
对AOP的概念一直是蒙蒙融融的。而且看Spring的文档上面对AOP的叙述还是不够清楚。 甚至看了文档还是不知道怎样使用Spring AOP, 直到我看了这篇文章。http://www.javalobby.com/forums/thread.jspa?messageID=91951283㚄。 AOP重要的两个概念, Advice和PointCut。Advice --> what 你做的事情。PointCut --> where 你想在什么地方做事情。 也就是类中的那些方法(注意:现在Spring AOP还只支持Method Interceptor)。 看看Spring中Advice的类的层次。
看看Pointcut的层次
Spring 提供了整合Advice和Pointcut的接口。
这样我们只要提供PointcutAdvisor, 就能够知道在那个类的那些方法里面做什么事情了。
现在我们还需要另外一个类帮助我们实现AOP。( org.springframework.aop.framework.ProxyFactoryBean)
beforeAdviceA beforeAdviceA
这样我们就对所有方法上面实现了beforeAdviceA,beforeAdviceA拦截。如果我们需要对这个类的特定方法进行拦截,如下
pointcut.advisor1 pointcut.advisor2 我们就实现了对myRawController的handleRequestInternal方法进行拦截。
If you don&apost need direct (non-AOP&aposd) access to your bean, then it may be better for the simplicity of the file to just use an anonymous inner bean, rather than declaring the bean seperately to the proxy:
beforeAdviceA interceptorA
详情请参考那篇文章。
发表评论
- 浏览: 220265 次
- 性别:

- 来自: 广州

- 详细资料
搜索本博客
我的相册
VB-seamless
共 13 张
共 13 张
最近加入圈子
最新评论
-
使用Terracotta和Tomcat建 ...
renavatior 写道"运行start.bat 9081 这样我们就启动了目 ...
-- by rainsf -
使用Terracotta和Tomcat建 ...
"运行start.bat 9081 这样我们就启动了目录9081中的tomcat ...
-- by renavatior -
广州3年多经验 5500的 ...
fucku 写道广州的软件厂家可比深圳多多了,不过比起北京上海来,还是少了很多, ...
-- by yongfan_420 -
广州3年多经验 5500的 ...
广州的软件厂家可比深圳多多了,不过比起北京上海来,还是少了很多,导致机会也没有这 ...
-- by fucku -
广州3年多经验 5500的 ...
想高工资就去厂家咯,老在集成商里面混能有多大个奔头
-- by fucku






评论排行榜