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?
|
|