Questions tagged [pointcut]

221 questions
3
votes
1 answer

java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut

I'm really very new to Spring AOP. In my application, I had configured HiddenHttpMethodFilter that converts method parameters into HTTP methods and enables Spring to handle other HTTP methods like DELETE, PUT etc including GET and POST. It is some…
Tiny
  • 27,221
  • 105
  • 339
  • 599
3
votes
3 answers

How to define an aspectj pointcut that picks out all constructors of a class that has a specific annotation?

Here is the annotation: @Target(value = ElementType.TYPE) @Retention(value = RetentionPolicy.RUNTIME) @Inherited public @interface MyAnnotation { String name(); } Here is one annotated class: @MyAnnotation(name="foo") public class ClassA { …
PineForest
  • 75
  • 1
  • 9
2
votes
1 answer

Spring AOP pointcut not applying to abstract methods

I have the following pointcut: @Before(value="execution(* datasync.polling.Poller+.*(..))") public void beforePoll() { logger.info("DOING THIS"); } And the following abstract class: package datasync.polling; import datasync.principle; public…
mogronalol
  • 2,946
  • 8
  • 38
  • 56
2
votes
0 answers

Excecution order of two pointcuts in the same class

I have defined two pointcuts in the same classs, one for all the methods and one for the methods in the controller package. @Pointcut("within(com.myCompany.*)") public void pointcutAnyMethod() { // Pointcut to define any class any…
Andres
  • 10,561
  • 4
  • 45
  • 63
2
votes
1 answer

Create custom method level annotation only available to specific return types [AOP]

I want to create an annotation which is only available to a specific type of return values. For example this is my annotation. @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) public @interface MyAnnotation { } I also have an…
cagdasalagoz
  • 460
  • 1
  • 12
  • 22
2
votes
1 answer

Spring AOP: @annotation() pointcut does not match type annotation

I'm writing an aspect to log Request and Response of each API call in a controller. I want to be able to use this annotation on a class, hence used @Target(ElementType.TYPE) Previously I had added @Target(ElementType.Method) and I was using this…
the_way
  • 171
  • 4
  • 14
2
votes
2 answers

How to advise static methods using Spring AOP?

Some logging needs to be done before and after execution of static method of a class. I tried to achieve this using Spring AOP but it is not working and for normal methods it is working. Please help me in understanding how to achieve that and it…
Abhishek
  • 91
  • 2
  • 12
2
votes
1 answer

Why this syntax error in SpringAOP @pointcut not popping any Error?

I am learning SpringAOP, while I am running basic programs I observed strange behaviour from eclipse(of course compiler). while I am practising on @Pointcut annotation I mistakenly added another parentheses in Pointcut expression..surprisingly I…
kishore
  • 85
  • 1
  • 11
2
votes
2 answers

Spring AOP ignores some methods of Hessian Service

I have an Aspect with the following pointcut definition @Pointcut("execution(public de.company.project..* *(..))") and a spring configuration containing the following
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
2
votes
1 answer

pointcut for method in parent abstract class

I have a scenario where my method to be intercepted is in the parent class and is not overridden in the pointcut class. Here is the sample classes: public abstract class A{ @RequestMapping(value = "/data", method = RequestMethod.POST, produces =…
Vishal
  • 123
  • 3
  • 14
2
votes
2 answers

spring aspectj pointcut reusable class

as described in https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html#aop-common-pointcuts Is it possible to create an independent class defining all the pointcuts and use it in other aspects, so that we should be able…
krmanish007
  • 6,749
  • 16
  • 58
  • 100
2
votes
1 answer

Does Sequence of method names in which they are specified in spring-aop-transaction.xml matter?

I came across a spring-aop-transaction.xml file in my project. There are two sections.
Tushar Banne
  • 1,587
  • 4
  • 20
  • 38
2
votes
1 answer

How to @Pointcut method from another module in Android Studio?

I have android application with 2 modules. First module contains Activity class defined like so: MyActivity extends AppCompatActivity Second module contains aspect class, where I want to create @Pointcut to MyActivity.onCreate method. It works if…
milkamar
  • 443
  • 6
  • 16
2
votes
1 answer

Spring AOP - @Before not executing

I'm trying to implement a simple Spring AOP (v4) example using @Before advice with an in-place pointcut expression, but the aspect method is not invoked. I have all the required dependencies(spring-aop, aopalliance, aspectweaver). What am I doing…
user1491636
  • 2,355
  • 11
  • 44
  • 71
2
votes
1 answer

how to get the Annotated object using aspectJ

I have an annotation like this: @Inherited @Documented @Target(value={ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Restful { } I annotated this class like this: @Restful public class TestAspect { public String…
Ikthiander
  • 3,917
  • 8
  • 37
  • 54