Questions tagged [aspectj]

AspectJ is an aspect-oriented extension to the Java programming language that enables clean modularization of crosscutting concerns such as logging, error handling, standards enforcement and feature variations. Use this tag for questions about the programmatic use of this extension. For downloads, support, IDE integration, & documentation, see the "learn more" for this tag.

AspectJ is an Aspect-Oriented Programming (AOP) extension to Java, created by Xerox, that has as main components aspects (consisting of pointcuts and advices) and join points.

For AspectJ Eclipse integration, also see AspectJ Development Tools (AJDT); for NetBeans integration, see AspectJ in NetBeans; for IntelliJ IDEA integration, see IDEA Web Help.

Books:

Documentation:

3304 questions
10
votes
1 answer

Spring - AspectJ pointcut for constructor object with annotation

I'm developing a java (JDK1.6) application with Spring framework(4.0.5) and AspectJ for AOP Logging. My Aspect classes work fine but I can't create a pointcut for constructor object. This is my object: @Controller public class ApplicationController…
Matteo Codogno
  • 1,569
  • 6
  • 21
  • 36
10
votes
2 answers

How to get annotated method parameter and his annotation

In my application I have methods with parameters annotated by some annotation. Now I want to write Aspect that do some preprocessing on annotated parameters using information from annotation attributes. For example, method: public void…
2dy
  • 129
  • 1
  • 1
  • 8
10
votes
3 answers

How to set springframework @Transactional with AspectJ

I want to use spring-aspects to make my methods transactional, but without using Spring AOP (Spring AOP works just fine with: ). I'm using Maven to manage my project. Is there a way to do compile time weaving on my project…
Mariusz Zawadzki
  • 479
  • 1
  • 3
  • 13
10
votes
2 answers

Does Spring AOP do compile time weaving or load time weaving?

I am starting to use Spring AOP for a project and I am a little bit confused about weaving. I know that Spring AOP has a dependency on AspectJweaver.jar, but as the documentation says, this is not for the weaving, but just that it uses some of the…
DaveJohnston
  • 10,031
  • 10
  • 54
  • 83
10
votes
1 answer

@AspectJ Class level Annotation Advice with Annotation as method argument

How can I get the annotation to be passed as the argument for the Advice defined for class-level annotation? Is it possible? From the post here I am able to get the point cut that identifies all the public method in the class which is marked by a…
param83
  • 453
  • 2
  • 6
  • 17
10
votes
2 answers

Why do I get a not exposed to the weaver warnings when making my Spring project?

I seem to get a bunch of warnings like this when I make my Spring project. The project uses Compile Time Weaving and various Spring annotations like Transactional, Autowired, and Configurable. I have three questions: What are they (What's the…
robert_difalco
  • 4,821
  • 4
  • 36
  • 58
10
votes
4 answers

Using AspectJ logging without Spring

I have just working on an old application which has poor log or no logs. It does not implement Spring framework. Is it possible to implement AspectJ logging functionality without Spring? If yes please suggest me some good tutorials.
Himanshu Yadav
  • 13,315
  • 46
  • 162
  • 291
10
votes
2 answers

AspectJ: two kinds of tutorials

From my research I know there are two ways of using AspectJ. First is by creating A.aj class and second by adding annotation @Aspect in A.java. I was looking for a good tutorial for this second kind, especially about lines like @After("call(void…
alicjasalamon
  • 4,171
  • 15
  • 41
  • 65
10
votes
3 answers

AspectJ: Error can't determine superclass of missing type

I get the error using an aspect in our application. What do I need to fix this error or what does this say to me? [AppClassLoader@13b8f62] error can't determine superclass of missing type xxx.yyy.zzz.execution.SystemVersion when weaving type…
Tima
  • 12,765
  • 23
  • 82
  • 125
10
votes
1 answer

Spring AOP: "no declaration can be found for element 'aop:config' "

I've seen that a few instances of this problem have been raised already. However, I am confident that I satisfy the criteria that has been outlined in those solutions. i.e. I'm pretty sure I have the desired jars on my class path + my schemalocation…
HellishHeat
  • 2,280
  • 4
  • 31
  • 37
9
votes
3 answers

access class variable in aspect class

i am creating an aspect class with spring aspectj as follow @Aspect public class AspectDemo { @Pointcut("execution(* abc.execute(..))") public void executeMethods() { } @Around("executeMethods()") public Object…
Hemant Metalia
  • 29,730
  • 18
  • 72
  • 91
9
votes
3 answers

What is a short example of inter-type declarations in AspectJ which demonstrates the usefulness of the approach?

I first thought about using ITDs to define the private static final Logger logger = ... for some unrelated cases, but it doesn't look enough like an obvious improvement to use that as a demonstration example. Is there some standard/suggested example…
soc
  • 27,983
  • 20
  • 111
  • 215
9
votes
3 answers

Proceed with variable arguments with AspectJ

I'm trying to normalize URIs across an application using AspectJ. I'm catching every call that is made to a method passing in a java.net.URI parameter using this code: Object around() : execution(* *(..,java.net.URI,..)) { for ( Object arg :…
Adam
  • 123
  • 2
  • 5
9
votes
1 answer

Is it possible to use SBT in a Java project with Hibernate and AspectJ?

What would I need to configure and what would automatically work? As far as I understand using both can be a bit tricky, because both use bytecode weaving. Can I keep using the more convenient configuration syntax or do I need the "full" Scala…
soc
  • 27,983
  • 20
  • 111
  • 215
9
votes
5 answers

NoSuchMethodError aspectOf() at runtime from building with iajc

We used aspectJ to get some metric on an existing application. When building and weaving with AJDT in eclipse, everything works great. But in the integration env. we use an ant script to build and deploy the application. The problem occur on an…
Cygnusx1
  • 5,329
  • 2
  • 27
  • 39