Questions tagged [pointcut]

221 questions
0
votes
0 answers

Spring PoinCut after service method only if called by not service

I want to make sure, that in my controller classes all entities that I got from service are detached. To make it happen I thought about creating pointcut with Spring AOP that would point to every service method call if called by controller (or every…
Vivent
  • 35
  • 2
  • 6
0
votes
0 answers

Binding to advice body getting inconsistent binding

I was able to get the @AfterThrowing work for my basic needs @AfterThrowing(pointcut = "within(@custom.SomeAnnotation *) || @annotation(custom.SomeAnnotation) ", throwing = "ex") public void intercept(Throwable ex) { // do stuff } But when I…
Rafael
  • 1
0
votes
1 answer

Why the Pointcut expression is not working

If i keep @Pointcut("within(org.example.ShoppingCart.*)") in AuthenticationAspect.java then the authenticate method is NOT getting invoked BUT when i change to @Pointcut("within(org.example..*)") then it does get invoked. Doesn't the 2nd PointCut…
Helena
  • 444
  • 2
  • 15
0
votes
1 answer

Not able to read annotation property inside Aspect when writing pointcut in a method

I have a custom annotation as annotation class MyHandler(val value:String) I wrote an aspect for functions using this annotation, also reading the value within the annotation for my processing. @Around("@annotation(myHandler)") fun…
mewan
  • 1
  • 1
0
votes
0 answers

@AfterReturning for multiple methods in a same controller AOP

I want to call multiple methods included in a same controller. But methods are different from input parameters. So I need to use one aspect method for those three methods included in same controller. @AfterReturning("execution(*…
Dulani Maheshi
  • 1,070
  • 1
  • 10
  • 30
0
votes
1 answer

Simple Aspect not Executing

I had this Aspect working then all of a sudden it stopped. @AfterThrowing all classes in and below the pointcut. You can see I added a constructor to the Aspect to ensure it is picked up by Spring and it is. Below is a class that I stepped…
user2774515
  • 31
  • 1
  • 5
0
votes
1 answer

Using Aspect advice with wildcard leading to multiple triggers and exceptions

Im new to AOP and have created a simple SpringBoot project to learn it. I've created a logging aspect which simple logs a message before triggering a get method that returns String. Upon adding wildcards (so it triggers for all get methods,…
arslan sana
  • 101
  • 1
  • 8
0
votes
1 answer

I am trying to make a pointcut. but its giving an Exception

here i am using a point cut annotation as follows: @Pointcut("Execution(* com.luv2code.springdemo.controller.*.*(..))") private void forControllerPackage() { } it giving me an exception which is as: Pointcut is not…
Ali Raza
  • 41
  • 1
  • 6
0
votes
0 answers

IllegalArgumentException: Pointcut is not well-formed: expecting '('

What is wrong with my pointcut? Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting '(' at character position 0 ru.ssau.tk.Ildar.Sandbox.spring.aop.mypractice.aspects.PointCuts.forAddBook My…
Ildar
  • 19
  • 3
0
votes
1 answer

Access user-defined object state using java reflection in @Aspect type class

I have a class A which declare a static logger instance and then used in the method of the class. class A { static Log log = LogFactory.getLog(A.class); person p = new Person(); public void methodA(){ // log.info("logging using apache…
Shiv Prakash
  • 33
  • 1
  • 6
0
votes
0 answers

PerformanceMonitorInterceptor : Logging time in ns

I'm using Aspects Pointcut to trace the execution time of my SQL call. Similar to - no logging for PerformanceMonitorInterceptor. I'm able to see the trace logs with the respective response time. I see the logged time is in ns unit. Is that the…
Rahul S L
  • 1
  • 3
0
votes
1 answer

How can assign multi parameters to the args in spring AOP pointcut

I wrote pointcut like this for the target method aaa. I want to enroll whole parameters of target method to the advice method's parameters. Could you let me know how can I make it. target method fun aaa( @RequestParam(value =…
0
votes
1 answer

Spring AOP pointcut expression matching caller's context

I am using Spring AOP. I want my target method be matched only when invoked from a certain package. For example, let's assume my target method is com.domain.target.MyService.run(), and that it can be accessed from anywhere in my project. However, I…
Tanvir
  • 542
  • 7
  • 16
0
votes
1 answer

How to write Pointcut expression for Spring AOP to weave meta-annotation in any level of deepness?

If I have Annotation: @Retention(RUNTIME) @Target({TYPE, METHOD}) public @interface Loggable { enum LogLevel { ERROR, WARN, INFO, DEBUG, TRACE; } LogLevel value() default DEBUG; } and trying to use it as target marker of Spring AOP…
Cest la vie
  • 143
  • 4
0
votes
1 answer

Java object with Lombok not working inside point cut annotated classes in spring boot

I have the following DTO object used in Java spring boot code. ExceptionResponseDTO.java package be.bytebrain.hrms.exception; import java.time.LocalDateTime; import lombok.Data; @Data public class ExceptionResponseDTO { private String…
Naveen Vignesh
  • 1,351
  • 10
  • 21