AspectJ doesn't provide any dependency injection features, but you
can use AspectJ in conjunction with an IoC container that does.
See section 6.8.3 of the Spring Reference Guide for details on
configuring aspects using Spring (http://static.springframework.org/
spring/docs/2.5.x/reference/aop.html#aop-aj-configure).
Regards, Adrian.
On 15 Mar 2008, at 14:09, Buck, Robert wrote:
Hello,
I have a family of aspects that are all identical except for an
"internal" name I want to uniquely assign to each aspect instance.
Rather than write one aspect class for each, I'd like to reuse one
class
for all. So what I would like to do is something like this:
<aspectj>
<aspects>
<concrete-aspect name="$com.verisign.aspectj.Hello$Aspect"
extends="com.verisign.aspectj.AbstractAspect">
<pointcut name="scope" expression="execution(public *
*.hello(..))"/>
<param name="id" value="hello"/> <<<<<< THIS
</concrete-aspect>
<concrete-aspect
name="$com.verisign.aspectj.Goodbye$Aspect("goodbye")"
extends="com.verisign.aspectj.AbstractAspect"> <<<< OR THIS
<pointcut name="scope" expression="execution(public *
*.goodbye(..))"/>
</concrete-aspect>
</aspects>
<weaver>
<include within="com.verisign.something.*"/>
</weaver>
</aspectj>
In the above "hello world" example, the aspect would
"System.out.println(id);", or some such.
Is this sort of thing possible?
Alternatively, can one pass in a constructor argument to the named
concrete aspect from the XML definition?
Or, can one pass in arguments to the "scope" method that is generated?
Thanks in advance,
Bob
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users