aspectj

Aspectj doesn't catch all events in spring framework?

My project is based on spring framework 2.5.4. And I try to add aspects for some controllers (I use aspectj 1.5.3). I've enabled auto-proxy in application-servlet.xml, just pasted these lines to the end of the xml file: <aop:aspectj-autoproxy /> <bean id="auditLogProcessor" class="com.example.bg.web.utils.AuditLogProcessor" /> Create...

How can I make Loadtime-AspectJ to work in applet

Since AspectJ LoadTime-Weaving needs to load the JVM with an agent/it's own classloader - is there a way to load/make changes in the user's JVM from my applet? or maybe just before loading the applet (with a parent applet?) ...

How to define / configure priority for multiple aspects using Spring AOP (or AspectJ)

Hi, I have been able to define multiple aspects (one is @Before and another is @Around) using Spring AOP (combined with AspectJ annotations) over a business service class. Currently they are getting called one by one (in sequence). However I would like to know how the priority of calling the aspects can be defined and where. Please gu...

How do you debug a series of Aspect in eclipse?

I've got a chain of aspects that are being executed in some cases but not in others. The stack typically looks something like this w/o giving an context information. There doesn't appear to be any logging that I can enable either. Thanks for any help on this. GeneratedMethodAccessor163.invoke(Object, Object[]) line: not available De...

AspectJ: parameter in a pointcut

I'm using AspectJ to advice all the public methods which do have an argument of a chosen class. I tried the following: pointcut permissionCheckMethods(Session sess) : (execution(public * *(.., Session)) && args(*, sess)); This is working wonderfully for methods with at least 2 arguments: public void delete(Object item, Session c...

Logging user actions

The customer wants us to "log" the "actions" that a user performs on our system: creation, deletion and update, mostly. I already have an aspect that logs the trace, but that works at a pretty low level logging every method call. So if a user clicked on the button "open medical file" the log would read: closePreviousFiles("patient zer...

Using join points call(* *.*(..)), can I expose the arguments to the advice if available?

With my aspect, I track the changes on certain collections by advising certain method calls on instances of java.util.Set, notably add(Object) and remove(Object). Since the changes are not reflected in the collection itself, invocations of Set.contains(Object) or Set.size() return wrong results. Therefore I want to intercept all method ...

How to quickly modify compiled java classes behaviour with aspectJ

How to use aspectJ to add functionality temporarily to some java application? Something like creating the aspect, compiling with ajc, using java command with some extra switch to apply aspect? ...

Pointcut not working with Spring AOP

In order to implement Logging using Spring AOP I followed these simple steps. But it seems like its not working. Any help would be useful 1) Created MyLoggingAspect class import org.aspectj.lang.ProceedingJoinPoint; public class MyLoggingAspect { public MyLoggingAspect() { super(); System.out.println("Instantiated M...

Use aspectj to profile selected methods

I'd like to use aspectj to profile a library. My plan was to mark methods that require profiling with an annotation: @Profiled("logicalUnitOfWork") And then have an aspect that would fire before and after methods that would use the logicalUnitOfWork to highlight the profiled content. So, my pointcut to start with looks like this. No...

Is it possible to get information about which advice has been caught in an adviceexecution pointcut ?

I have an aspect in my application that intercepts every advice execution on the system. I want to be able to identify which advice is being "intercepted" by my adviceexecution pointcut like this //... some code in AdviceInspector.aj before(): adviceexecution() && !within(AdviceInspector) { System.out.println("advice execution be...

Java synchronization and performance in an aspect

I just realized that I need to synchronize a significant amount of data collection code in an aspect but performance is a real concern. If performance degrades too much my tool will be thrown out. I will be writing ints and longs individually and to various arrays, ArrayLists and Maps. There will be multiple threads of an application tha...

Placing advice on any parameter of a given type in AspectJ

Is there a way to put advice on any method with a parameter of a given type. I'm planning to use this for a class that needs input filtering. As an example: @Filtered class Unsafe { public void doStuff (String input) { ... } public void doMoreStuff (String input, int value, String name) { ... } } I want to write advice that ...

AspectJ load-time weaving in production systems

Does anyone have an experience with pure AspectJ load time weaving in production systems (mostly interesting Tomcat related activities)? I'm slightly worrying regarding memory footprint and cpu overhead. ...

configurable vs component with spring and aspectj

When using aspectj, why use @Component over @Configurable. I've got spring and aspectj setup for @Transactional support, aspects on self-invocation, and injection into JPA entities. This works great. I'm using @Component for most classes that need injection, and thus either having them injected into their dependencies. Or, when I can'...

Why doesn't AspectJ compile-time weaving of Spring's @Configurable work?

Update 5: I've downloaded the latest Spring ToolsSuite IDE based on the latest Eclipse. When I import my project as a Maven project, Eclipse/STS appears to use the Maven goals for building my project. This means AspectJ finally works correctly in Eclipse. Update 4: I have ended up just using Maven + AspectJ plugin for compile-time weavi...

Eclipse: How to convert a web project into an AspectJ project and weave and run it using the AJDT plug in?

What I want to do: I want to use the @Configured annotation with Spring. It requires AspectJ to be enabled. I thought that using the AJDT plugin for compile time weaving would solve this problem. Before installing the plug in the dependencies which were supposed to be injected into my @Configured object remained null. What I have don...

iajc does not generate META-INF/aop-ajc.xml if sourceRootCopyFilter is specified

I am very new to aspects, so apologize in advance for any stupid questions. I use iajc task to create the aspect jar. I specify outxml=true, which generates META-INF/aop-ajc.xml, which includes all aspects. Recently I added sourceRootCopyFilter, so that the source .aj files are included in jar. This works, but the generated jar no long...

Autowiring Unmanaged Beans Annotated With @Component

I want to use @AutoWired to inject a non-managed bean configured with @Component into a managed bean. I'm pretty sure I have the configuration right, but for some reason I keep getting the exception: No unique bean of type [foo.Baz] is defined: Unsatisfied dependency of type [class foo.Baz]: expected at least 1 matching bean Based on...

AspectJ - Compile Java source with precompiled aspects

Let's say I have few aspects, which I have already compiled, and now I just want to compile single source file, but without recompiling the aspects, since it takes a lot of time. Is there any way to do so? For example, I have the following: Trace.aj Log.aj Test.java All of them were compiled during my "build-all", and now I've chang...