Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] About aop.xml scope

If you're referring to me, I did all of that ;) I have also read and tried out every LTW example possible. It's a no-go beyond getting lucky when starting tomcat... or just testing a few classes at a time.

On Mon, Jun 8, 2009 at 7:51 AM, <jeanlouis.pasturel@xxxxxxxxxxxxxxxxxx> wrote:

Using aspectj ltw with Spring, as I have understood, needs to use the Spring
LTW agent and to modify the application-context.xml file as explained :
http://static.springframework.org/spring/docs/2.5.x/reference/aop.html#aop-u
sing-aspectj

§ 6.8.4 and following





Jean-Louis Pasturel
jeanlouis.pasturel@xxxxxxxxxxxxxxxxxx


-----Message d'origine-----
[mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de Simone Gianni
Envoyé : lundi 8 juin 2009 13:16
À : aspectj-users@xxxxxxxxxxx
Objet : Re: [aspectj-users] About aop.xml scope

Hi Federico and Tahir,

Tahir guess is right : there is no "jar" scope in Java, not because it
would not be a good idea, simply because there is no support for that in
the Java classloading system. When using an URL classloader it is
possible to know from which jar that resource is coming from, but only
using methods specific to URLClassLoader and/or interpreting the
Class.getResource returned URL in an implementation specific mapping,
both solutions are not applicable in a real production environment,
especially when web application servers come in play with their own
classloaders.

Multiple aop.xml files are detected and merged together, as explained
here
http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html
:

When several configuration files are visible from a given weaving class
loader their contents are conceptually merged. The files are merged in
the order they are found on the search path (with a regular
getResourceAsStream lookup) according to the following rules:

   *

     The set of available aspects is the set of all declared and
     defined aspects (aspect and concrete-aspect elements of the
     aspects section).

   *

     The set of aspects used for weaving is the subset of the available
     aspects that are matched by at least one include statement and are
     not matched by any exclude statements. If there are no include
     statements then all non-excluded aspects are included.

   *

     The set of types to be woven are those types matched by at least
     one weaver include element and not matched by any weaver exclude
     element. If there are no weaver include statements then all
     non-excluded types are included.

   *

     The weaver options are derived by taking the union of the options
     specified in each of the weaver options attribute specifications.
     Where an option takes a value e.g. -warn:none the most recently
     defined value will be used.

It is not an error for the same aspect to be defined to the weaver in
more than one visible META-INF/aop.xml file. However, if the same
concrete aspect is defined in more than one aop.xml file then an error
will be issued. A concrete aspect defined in this way will be used to
weave types loaded by the class loader that loaded the aop.xml file in
which it was defined.


In a web application "the order they are found" will be :
- WEB-INF/classes/...
- WEB-INF/lib/*.jar (I don't know of any reliable standard on the
loading order of jars here)
- Endorsed libs
- Server "common " libs
- Server libs themselves

Hope this helps,
Simone



Federico Firpo Bodner wrote:
> Thanks Tahir, but my doubt is: What happens if I put a second jar file
with
> a second aop.xml file? Both configurations are merged? Or each jar keeps
the
> settings in their own aop.xml?
>
> Regards,
> Federico
>
> -----Mensaje original-----
> De: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] En nombre de Tahir Akhtar
> Enviado el: lunes, 08 de junio de 2009 11:34
> Para: aspectj-users@xxxxxxxxxxx
> Asunto: Re: [aspectj-users] About aop.xml scope
>
> Hi,
> Here is from my own experience:
> I have a aop.xml in a jar and it is used to weave all the jars in
> WEB-INF/lib and all the classes in WEB-INF/classes.
> When I place the jar containing aop.xml in Tomcat/common/lib it can even
> weave the classes in jars provided by tomcat.
>
> regards,
> Tahir Akhtar
> pilux wrote:
>
>> Hi All,
>>
>>     I have a doubt. Settings in aop.xml are scoped only to the classes
>> contained in same jar file, or are exported and merged into whole JVM
>> weaver?
>>
>> Thanks and regards, Federico
>>
>>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


--
Simone Gianni            CEO Semeru s.r.l.           Apache Committer
http://www.simonegianni.it/

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration.
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



--
My Latest Song: http://soundclick.com/share?songid=7173778
My Original Music: http://www.soundclick.com/KenEgervari
My Humorous Speeches: http://www.youtube.com/user/egervari
My Facebook: http://www.new.facebook.com/profile.php?id=716270499/profile.php?id=716270499

Back to the top