aspectj

Hibernate Annotation + AspectJ -> Attributes names pbs in HQL

I'm looking for a way to use aspects to inject parameters in hibernate annotated classes. Here is a user : @Entity public class User implements IHasCity { @Id private int id; private String name; } public interface IHasCity { } Here is an aspect contributing to that User public aspect ACity { @Column private S...

How to Refactor aspectJ code

Hi, I'm trying to refactor aspectJ code in order to avoid collision with other jars. I took the source code from the eclipse CVS and refactored all the source code (including build scripts etc.), but it seems that I need to refactor the eclipse plugin jars as well (which I'm not sure I need at all) Can anyone recommend a good way of re...

Usage question: Spring AOP vs. AspectJ weaving

I am working on profiling a legacy application using Spring AOP and I want to get some data points around a decision I need to make. This is what I have done so far: I have created the code and configuration using Spring AOP which would help me to profile the beans that are being managed by the Spring container. While profiling the dao...

AspectJ beginner question

I am starting to learn AspectJ. From reading tutorials, I know that I can weave aspects into already compiled class files. However, I just cannot figure out the command that allows me to merge a compiled class file with aspects written on an another file. And one more thing, is it mandatory to have the aspects written in a *.aj file? Tha...

Configuring SpringSource Tool Suite wth AspectJ

How can I configure the SpringSource Tool Suite(ver 2.3.0) Spring project to accept .aj (AspectJ) file? Currently it does not recognize .aj file. And I cannot add *.aj file because it's a Spring project, not an AspectJ project. ...

How to use spring-roo entities from Eclipse RCP/RAP project

I have created a domain model using spring-roo, which makes heavy use of Spring and AspectJ. My model is deploying nicely as a OSGi bundle, and from the Spring STS (eclipse-based) IDE, I can call the entity classes, etc. I need to access these domain classes from a Eclipse RCP/RAP application, and this project I keep in the normal Eclip...

How to create an aspect on class, that is not a bean using Spring AOP?

Hello, I work on an legacy application, where Spring AOP (namely ProxyFactoryBean) is used. I need to add an aspect around a method of a certain class. This class is not a bean however. The AspecjJ pointcut expression would be like this: execution(* xyz.package.Class.method()) I created a MethodInterceptor and AspectJExpressionPoin...

Reading annotation property in aspect

How to read annotation property value in aspect? I want my Around advice to be executed for all joint points annotated with @Transactional(readonly=false). @Around("execution(* com.mycompany.services.*.*(..)) " + "&& @annotation(org.springframework.transaction.annotation.Transactional)") public Object myMethod(ProceedingJoinPoint pjp) ...

Maven: compile aspectj project containing Java 1.6 source

What I want to do is fairly easy. Or so you would think. However, nothing is working properly. Requirement: Using maven, compile Java 1.6 project using AspectJ compiler. Note: Our code cannot compile with javac. That is, it fails compilation if aspects are not woven in (because we have aspects that soften exceptions). Questions (ba...

Pointcut matching methods with annotated parameters

I need to create an aspect with a pointcut matching a method if: Is public Its class is annotated with @Controller (Finally does not) One of its parameters (can have many) is annotated with @MyParamAnnotation. I think the first two conditions are easy, but I don't know if its possible to accomplish the third with Spring. If it is no...

How to override ant task stored in ant lib directory

At my work we use AspectJ in some of our Java projects. To get this to work with ant builds we have been placing aspectjtools.jar within ant/lib/. I am now working on a particular Java project and need to use a newer version of aspectJ. I don't want to have to get everyone who uses the project to update their local copy of aspectjtools....

Spring AOP pointcut that matches annotation on interface

Hello, this is my first post here, so I apologize in advance for any stupidity on my side. I have a service class implemented in Java 6 / Spring 3 that needs an annotation to restrict access by role. I have defined an annotation called RequiredPermission that has as its value attribute one or more values from an enum called OperationT...

Define pointcut to capture an interface but not parent or sub interfaces

I was wondering how to define a pointcut in aspecJ the captures any method of an interface but not the methods of any parent or sub interface. pubic interface A { void methodA(); } pubic interface B extends A { void methodB(); } pubic interface C extends B { void methodC(); } I would like a poincut that only catches methodB() an...

Entity Aspect (in Spring)

Hi guys, I'm having a bit of a problem defining my aspects. I've got a bunch of entities that I'd like to profile the get-methods in, so I've written the following pointcut and method @Pointcut("execution(* tld.myproject.data.entities.*.get*()") public void getEntityProperty() {} @Around("getEntityProperty()") public Object profileGet...

AspectJ join point with simple types

Hi! Are there defined join points in arithmetics that I can catch? Something like: int a = 4; int b = 2; int c = a + b; Can I make a pointcut that catches any one of those lines? And what context will I be able to get? I would like to add a before() to all int/float/double manipulation done in a particular method on a class, is tha...

How to capture button click if more than one button in AspectJ?

Hi all, I wonder if we can capture that which button is clicked if there are more than one button. On this example, can we reach //do something1 and //do something2 parts with joinPoints? public class Test { public Test() { JButton j1 = new JButton("button1"); j1.addActionListener(this); JButton j2 = new...

Insert code into a method - Java

Is there a way to automatically insert code into a method? I have the following typical field with a getter and setter and I would like to insert the indicated code into the setter method that records if the field was modified as well to insert the indicated "isFirstNameModified" field to also track if the field was modified or not. p...

Best solution for using AOP with OSGI?

I am using Equinox, so the Equinox Aspect project seems like a no-brainer, but that project appears to be inactive and has only one page of documentation that leaves me hanging at the end. Other than that project, I do not see many options for using AOP in OSGI. Let me know what you all think and what the possibilities are, thanks :) ...

AspectJ Load-time Weaving in Spring with method-call pointcuts?

I'm experimenting with AspectJ Load-time Weaving in Spring as described here. I've checked out the sample code, and it works as advertised. But when I try to change the pointcut of the PerformanceAdvice from execution(..) to call(..) semantics, the advice no longer gets executed. I know that Spring AOP does not support call(..) semant...

aspectJ in IntelliJ

Hi, I want to write simple example using aspectJ in intelliJ. And... i can't. I can't find any tutorial that shows step by step what and how i should do. I can't find any example with working code. Can someone help me with this? Any link, or simple how to? One class with main, and one aspect. intellij 9.0.2, with aspectj weaver...