[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] Load-time weaving of aspect with dynamically loaded classes
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Thu, 22 Apr 2010 08:18:26 -0700
- Delivered-to: email@example.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type :content-transfer-encoding; bh=9mwgFahs0BJ4s+2dJ1P6xiGJI5cOVBusYPpnMZBS0po=; b=T1ek09ItwH1Mn/Iqgsj1okPO4MCxWwGmWrtdvLV7PiXbQ+9Qba7KDxSgPGPXsihBMl y7CLnuShbU0gh6ViSrNwaV/yXJNXF51zpP4K7/1ArsSTMhQvSEW/bifpUY75emrjQt5u xGL+D8OEEQNopyhbWWqLqWCIVg2MzKLQu1u4g=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=qXCl+LP15KwFikzI56Hkw4QYzV9iUiMXoXEuT2h6YEPwLa26V9Y3pCBw845uvYOqGo MjyoLJLsNVSW5tkKgP1+ZZI70yj/KATVhkvPSr3CZYy4w2lsghG3iKatQp8EQfKvh+Se L6L4HkK9I6ZlF0vh/WR0XYO9dHvWIlRM00Psg=
This is definetly an area where documentation is lacking...
If you are able to use your own classloader in the hierarchy, a
WeavingURLClassLoader is what you can use - create it (configured with
an aspect path that points to your aspect) and let it load classes.
If you can't plugin in a classloader you may be able to just use the
WeavingAdaptor which can be plugged into any classloader (if you can
modify that classloader). See how it is used by the
Your easiest option really would be the javaagent - but I guess if you
cant use it, you cant use it...
2010/4/21 Redeemer <redeemer.sk@xxxxxxxxx>:
> I am working on a system, that supports dynamically loaded 3rd party plugins
> no source code nor bytecode of them in advance). In the system, there is a
> class (in the sources I am coding), say A, and I need to be able to define
> an advice
> that gets executed whenever any of these plugins calls some methods on any
> of A.
> So, I made an aspect that catches those calls and defines the advice. Now I
> an aspect bytecode as well (thanks to eclipse).
> Now it seems that what I need to make it working, is a load-time weaving
> so that whenever the plugin class is dynamically loaded, its weaven with the
> To get it complicated, I have to avoid running the system with 'aj' or with
> weaving agent.
> Having the 2 options of 3 total for load-time weaving restricted, it seems
> that what I need
> to do is to use some magic with WeavingURLClassLoader and let it load the
> Can anybody please give me a hint how to do that ? Because I have no clue
> how to use it to
> make it to do just that. Is that really what I need and Is what I need even
> possible ?
> Thanks in advance
> aspectj-users mailing list