Here is a simpler solution I like better than using Spring: put the
aspect names into a resource bundle, which maps to argument list
provided to the AbstractApect. The argument is constant and does not
need to change, so this will work great.
 
Thanks
 
Bob

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian Colyer
Sent: Saturday, March 15, 2008 10:39 AM
To: [email protected]
Subject: Re: [aspectj-users] Params to Aspects?


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(&quot;goodbye&quot;)"
        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

Reply via email to