Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ for non Spring beans

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.


Maybe this helps.
-- 
Alexander Kriegisch


Am 26.08.2015 um 13:29 schrieb Rallavagu <rallavagu@xxxxxxxxx>:

After making aop.xml available to classloader by copying it into WEB-INF/classes/META-INF it is picked up. However, none of the classes are picked up for weaving. Getting "[TomcatInstrumentableClassLoader@17918d9b] debug not weaving" messages printed for almost all spring, hibernate and my local classes. I guess I am one more step closer but not quite there yet. Any clues?

On 8/26/15 3:31 AM, Rallavagu wrote:
After further investigation, it appears that aspectj is picking up the "aop.xml" from spring-aspects.jar instead of META-INF/aop.xml. Trying to figure how to make it look into META-INF/aop.xml instead.

On 8/25/15 10:03 AM, Rallavagu wrote:
Thanks for the response. I have reconfigured the app to use aspectj instead of spring aop. Running on tomcat 7 and still does not seem to work. The previous aspects also stopped working. I guess there is some configuration or something is missing but can't figure out. I have done the following.

1. Removed <aop:aspectj-autoproxy/> and added
<context:load-time-weaver aspectj-weaving="on"

weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver" /> instead

2. Added aop.xml to META-INF directory
3. Added following to META-INF/context.xml for the app

<Context path="/app" docBase="">
   <Loader

loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
</Context>

Application starts fine, but does not seem to engage. Any clues? Thanks.


On 8/25/15 6:41 AM, Alexander Kriegisch wrote:
Please read Spring manual, chapter 10.8, in order to learn how to use full AspectJ via load-time weaving from within Spring. LTW works for non-Spring classes as well because it does not rely on dynamic proxies as simple Spring AOP does.



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Back to the top