[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Non-singleton aspects and Spring configuration
|
Using aspectOf(Object) won't work in this case since Spring doesn't
know what object instance to pass as the parameter value. To make it
work, you need to use a different approach as described here:
http://www.aspectprogrammer.org/blogs/adrian/2005/03/hacking_with_ha.html
You should be able to crib all the code from that entry - it will be a
supported part of Spring in a future release (waiting on AJ 5 to ship
before Spring can include it...)
Regards, Adrian.
On 06/09/05, Nemanja Kostic <n.kostic@xxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> what is the way to configure non singleton aspects (using perthis)
> and Spring?
> I saw on some Adrian's slides that in this case factory-method in Spring
> configuration
> should be aspectOf(Object). Should I put something instead of Object or
> just to leave it as it is?
> Probably very dumb question, but have no idea how to become non-dumb. :)
>
> I have something like this:
> public abstract aspect BaseAspect perthis(advisedOperation()) {
> abstract pointcut advisedOperation(); ....
>
> In Spring XML I use:
> <bean id="cacheAspect"
> class="com.aspectcms.aspects.production.components.CacheAspect"
> factory-method="aspectOf(Object)" parent="baseAspect">
> </bean>
>
> CacheAspect extends BaseAspect and override advisedOperation() pointcut.
>
> When I run it, I get error:
> Exception in thread "main"
> org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'cacheAspect' defined in class path
> resource [spring-aspectCMS.xml]:
> Cannot find matching factory method 'aspectOf(Object)' on class
> [com.aspectcms.aspects.production.components.CacheAspect]
>
>
> Thanks,
> Nemanja.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
--
-- Adrian
adrian.colyer@xxxxxxxxx