Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Restricting LTW to a ClassLoader

Hi Norman,

I hope you don't mind, I found your question so interesting that I
wrote a blog about it and have included a solution there:

http://andrewclement.blogspot.com/2010/01/groovy-and-aspectj-load-time-weaving.html

It is basically a 'glue' classloader that wires the GroovyClassLoader
into an AspectJ weaver instance.  Would that work for you?

cheers,
Andy

2010/1/26 Norman Elton <normelton@xxxxxxxxx>:
> The AspectJ documentation seems to indicate that you can restrict
> weaving to a particular ClassLoader, instead of specifying a javaagent
> at runtime. I'm using LTW to weave into Groovy scripts, which are
> loaded from a GroovyClassLoader. I tried the obvious:
>
> GroovyClassLoader loader = new GroovyClassLoader(new
> WeavingURLClassLoader(this.getClass().getClassLoader()));
> Class<? extends Runnable> groovy_class = loader.parseClass(new
> File("bundle/GroovyPoint.groovy"));
>
> But it didn't do anything. Is there another way to tie a weaving
> classloader into an existing class loader, so that all loaded classes
> are weaved at runtime? Preferably without the need to set a global
> javaagent.
>
> Thanks!
>
> Norman
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top