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
1
vote
2 answers

@Before @PostConstruct Spring AOP ineterception

I'm trying to write an aspect that can intercept PostConstruct methods. I've looked at related questions on SO and others, and following them, this is what I have so far: The Spring…
ginglymus
  • 51
  • 7
1
vote
1 answer

Using @Aspect with @Conditional

I want to conditionally create an Aspect depending on a value read from the properties file. (It is related to profiling, that's why the intended selective use). I have tried to create a class that implements Condition and therefore the matches()…
Neill Lima
  • 331
  • 3
  • 11
1
vote
2 answers

How to inject necessary objects into AspectJ aspects using Guice

Is there a way to use Guice and AspectJ for situation where i have an aspect which have to use some complex-to-instantiate service in its logic? For example: @Aspect public class SomeAspect { private final ComplexServiceMangedByGuice…
4evertoblerone
  • 95
  • 1
  • 3
  • 12
1
vote
2 answers

AspectJ in Spring: CTW vs LTW

Question regarding AspectJ in Spring: CTW vs LTW. What's the difference? As far i understand the both approaches make the same - they both are producing java class with incorporated aspect logic instead of original class. CTW do it during compile…
Jcass
  • 21
  • 3
1
vote
1 answer

AspectJ, Can it be used for large scale loggin

I am adding logging into existing source code (large source code) to give a detailed logging, we decided the backend for logging (using face book scribe, and tested ). I am thinking of using Aspect oriented ways to add logging calls into all the…
Mani
  • 603
  • 1
  • 5
  • 6
1
vote
0 answers

AOP not working in Spring Boot

I'm working on AOP for the first time. It's not working - Maybe I'm mixing up Spring AOP and AspectJ, I'm not sure. dependency declaration in Gradle file dependencies { compile fileTree(dir: 'libs', include: '*.jar') ... …
FARSiM
  • 71
  • 1
  • 7
1
vote
1 answer

Adding some boolean conditions in pointcut expression

I'm using some aspect around advice methods. I have methods for controller, service and repository. @Around("execution(* com.abc..controller..*(..)) && @annotation(audit)") public Object controllerAround(ProceedingJoinPoint proceedingJoinPoint,…
Abhishek Ramachandran
  • 1,160
  • 1
  • 13
  • 34
1
vote
1 answer

AspectJ Cannot resolve reference to bean 'selectAll'

Here are classes and xml configuration for Java/AspectJ demo project, but it fails. Project is built in eclipse. I searched on the net, added all libraries but it still fails. Any idea what might be wrong? UPDATE: These classes were added to eclipse…
Nenad Bulatović
  • 7,238
  • 14
  • 83
  • 113
1
vote
1 answer

Log message on Spring AOP Aspect start up

how to log message on Spring AOP aspect start up? The only way I see is to specify flag on every intercepted method and check. May be any other options? Thanks
antongarakh
  • 570
  • 6
  • 16
1
vote
1 answer

aspectj cross-thread pointcut

I am new with AspectJ annotation for Java, and I am wondering if it is possible to put pointcut on a cross thread invocation. Here is the code: public class App { public static void main( String[] args ) { new…
Irwan Hendra
  • 150
  • 10
1
vote
1 answer

Is it possible to weave some classes from a jar while excluding the rest of the classes?

I am trying to to extend a 3rd lib code with new capabilities. And since I only need to inject some code around one method from one class, I figured I can either: Fork the project and apply my changes (seems sloppy, and will definitely require lots…
Younes Regaieg
  • 4,156
  • 2
  • 21
  • 37
1
vote
1 answer

AspectJ not working using IntelliJ

For some reason IntelliJ doesn't pick up the AspectJ dependency so when I try to use any AspectJ library it does not recognize it even though the AspectJ jar is installed in my repository. My pom.xml has the following: ...
crayon_box
  • 61
  • 1
  • 7
1
vote
2 answers

Content assist on pointcut definition using Eclipse and AspectJ (AJDT)

I was wondering if there is a way to activate the auto completion on the primitive pointcut definition in eclipse. It is very annoying to write the full qualified name of a class method by hand.
Jack
  • 1,066
  • 2
  • 10
  • 22
1
vote
1 answer

Spring - Aspectj is not getting applied over obfuscated(YGuard) binaries(jars)

I have one jar in which I have used the Aspect to have point cuts around a method. The aspect works fine here and around advice gets executed properly around the method at runtime. But when I obfuscate this jar and execute it then it gives me below…
Hokam
  • 924
  • 7
  • 19
1
vote
0 answers

Spring Framework and AspectJ

I am currently working on a REST API that will be using the Spring framework. My team is looking into using some AOP for the purpose of maintaining cross-cutting concerns. I have had success with Spring AOP, but later realized that it may not be…