由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - spring AOP question
相关主题
another aspectJ questionaspectJ question
What do you think about AOP?关于Exception,Catch
spring transaction的问题如何把函数体放入到 try ... catch ... 中
看Spring真是头大how to weave an existing jar ?
How to intercept a method callaspectJ Question
AOP 中的 self-invocation 问题有多少人对annotation这个东西不满,请举手!!
这样理解spring的AOPinteresting
aspectJ questionAspectJ question
相关话题的讨论汇总
话题: spring话题: aop话题: aspectj话题: calls话题: bean
进入Java版参与讨论
1 (共1页)
c******n
发帖数: 4965
1
I want to catch all calls to HibernateTemplate.save(Obj)
so I want to use Aspects to define pointcuts around them
but the problem is
Spring AOP only catches calls on beans, if the object is not a bean, but
created instead through a new() , then it won't catch these calls.
in our existing project, the HibernateTemplate instances could be a bean
handed in or it could be created through new() somewhere.
so I have to use aspectj compiler directly now, right?
g*****g
发帖数: 34805
2
Check if you can refactor a little bit. Spring AOP is much
simpler than AspectJ.

【在 c******n 的大作中提到】
: I want to catch all calls to HibernateTemplate.save(Obj)
: so I want to use Aspects to define pointcuts around them
: but the problem is
: Spring AOP only catches calls on beans, if the object is not a bean, but
: created instead through a new() , then it won't catch these calls.
: in our existing project, the HibernateTemplate instances could be a bean
: handed in or it could be created through new() somewhere.
: so I have to use aspectj compiler directly now, right?

n*********n
发帖数: 580
3
You will need to declare the AspectJ aspect as a spring bean with the
factory-method="aspectOf", so that its properties can be injected by spring.

【在 c******n 的大作中提到】
: I want to catch all calls to HibernateTemplate.save(Obj)
: so I want to use Aspects to define pointcuts around them
: but the problem is
: Spring AOP only catches calls on beans, if the object is not a bean, but
: created instead through a new() , then it won't catch these calls.
: in our existing project, the HibernateTemplate instances could be a bean
: handed in or it could be created through new() somewhere.
: so I have to use aspectj compiler directly now, right?

1 (共1页)
进入Java版参与讨论
相关主题
AspectJ questionHow to intercept a method call
aspectJ + ant , how to define task?AOP 中的 self-invocation 问题
aspectj question这样理解spring的AOP
没有源代码,想替换掉一个class文件里的类aspectJ question
another aspectJ questionaspectJ question
What do you think about AOP?关于Exception,Catch
spring transaction的问题如何把函数体放入到 try ... catch ... 中
看Spring真是头大how to weave an existing jar ?
相关话题的讨论汇总
话题: spring话题: aop话题: aspectj话题: calls话题: bean