aspectj

java agents with maven in eclipse

hi, I'm running aspectjweaver as a javaagent in Eclipse. I use maven to manage my dependencies, but I need to put a path to aspectjweaver on the command line. What's the recommended way to do this? Save another copy in my workspace? Reference my local repository? thanks, Jeff ...

How do I mix in ajc with my already setup groovyc/javac ant configuration?

I recently configured groovy 1.6 (w/Java 6) into my ant build.xml script, so that it compiles everything through groovy, with the embedded javac command: <target name="build-project" depends="init"> <groovyc destdir="antbin" classpathref="CIMS.classpath"> <src path="src"/> <src path="test"/> <classpath refid=...

Which static analysis tool for Java is easiest to extend?

Which static analysis tools for Java has easiest extension mechanism. I checked PMD But the process of writing custom rules appears to be very involved. Specifically, I want to know whether there is any tools that offers AspectJ like syntax for picking out interesting areas of code? I am aware of AspectJ's declare warning but it appear...

JNLP/Webstart - Setting environment variables

Is there a way via the jnlp file, to set up an environmental variable? I want to set the JAVA_TOOL_OPTIONS in order to do some LTW with aspectj. Thanks ...

Startup performance of Spring @Configurable with Compile Time Weaving

Hi this is my first question on stack overflow, so please be kind. i am running an app with spring 2.5.x Configurable Annotations Compile time weaving (CTW) maven eclipse/ajdt I use CTW and everything runs fine. But if i instantiate an annotated class for the first time it takes very long. the second time it is very fast. Looking ...

Maven vs. AspectJ - Example?

MY aspect works great from Eclipse with AspectJ plugin, however if I try to use it with Maven I get .... nothing. I tried this http://mojo.codehaus.org/aspectj-maven-plugin/includeExclude.html I add loggin in my aspect and I try to test it with junit test, but when I run mvn clean mvn test I get... [INFO] [aspectj:compile {execut...

AspectJ vs. toString()

public pointcut myToString() : within(mypackage.*) String around(): myToString(){ System.out.println("myToString"); return proceed(); } It works only if I override toString in class Im trying to weave, is there any way to make it work on all toString methods? ...

Testing an AspectJ Aspect

When writing aspects, how can I test that they do match and that they are invoked when I want them to? I'm using @Aspect declarations with Spring 2.5.6. I don't care about the functionality, that's extracted and tested otherwise. ...

Why do my aspects get executed in their original setting and not when packed as a separate jar and called from elsewhere?

Hi all, I am a newbie to aspectj... I have written the following aspect which is intended to add logging to function calls of type public * doSomething*(..). If my main class is part of the same project the weaving of the aspect is performed without a glitch and the code executes. If I pack up the weaved code into a jar and call it fr...

Aspectj in spring

I am getting the following error when i try to auto wire aspectj in spring org.xml.sax.SAXParseException: The prefix "aop" for element "aop:aspectj-autoproxy" is not bound. my appContext.xml entry looks like ..... <aop:aspectj-autoproxy/> <bean id="helloFromAspectJ" class="com.cvs.esps.aspect.logging.TestAspect"/> ..... some hel...

A .Net aspect weaver supporting relationship aspect implementation

With relationship aspects implemented in AspectJ I can associate objects of two types in the following way (see code example below). I would like to transfer this concept to .net. Can you point me towards a .net weaver implementation that will allow me to do this or something similar? Relationship aspects are designed by Pearce & Noble....

Spring Dependency Injecting an annotated Aspect

Using Spring I've had some issues with doing a dependency injection on an annotated Aspect class. CacheService is injected upon the Spring context's startup, but when the weaving takes place, it says that the cacheService is null. So I am forced to relook up the spring context manually and get the bean from there. Is there another way ...

Trouble configuring AspectJ LTW with Tomcat and Spring

Hi all, I'm having some problems getting load-time weaving to work with Spring in my Tomcat 6 webapp. I only want to use it for transactions (so that self-invocation respects transactional annotations, which it doesn't with AOP proxying). It appears that the weaver is being loaded, but my annotated classes aren't actually being woven. Wh...

AspectJ Inner-Class Join points

Hi everyone, I wonder is there a way to reach the code using aspect in "//do something" part? Thanks in advance. Turan. public class Test { private class InnerTest { public InnerTest() { JButton j = new JButton("button"); j.addActionListener(new ActionListener() { public void action...

maven cobertura reports 0% with aspectj

Has anyone been able to use maven2 with the Aspectj plugin, and Cobertura plugin? I keep getting 0% coverage, when I should get something. Cobertura instrumentation is running before Aspectj weaving which, I think, is messing up the Cobertura instrumentation. Also, Cobertura is giving warnings about my aspects, it looks like it is trying...

Advise in AspectJ to change control flow

I'm just starting to learn AspectJ, and I have use-case for say, User login. If a user's session data (cookies) doesn't match the stored data on the server, I want to change the function called. Say I have two operations: class HttpServlet { public function() { } public function2() { } public doLogin() { } } ...

Spring load time weaving not detecting class annotated with @configurable

I'm having trouble getting AspectJ to perform load time weaving on a class annotated with @configurable in my main project. No fields get set and none of the setters are touched. I don't think there's trouble with the configuration itself, because I've extracted the configuration and tested it on a smaller sandbox project. Just for the...

Adding validations to Java Beans via Annotations

I want to add validations to a Java Bean. For example, I want to do the following: @MaxLength(50) @RequiredField public void setEmployeeName(String name){ ..... } I know I can write code that gets the validations for a specific method by calling method.getDeclaredAnnotation after all the bean values have been set. I would like to...

How can I use a singleton class in AOP (aspect oriented programming)?

Language by choice is AspectJ but I am open for a generic answer. ...

AspectJ problem

Hi I am new to AspectJ and I would like to find out if creating variants of a class using Aspects - I will create another instance of the class as well? ...