Questions tagged [spring-aop]

Spring AOP is the Spring Framework's version of AOP, implemented in pure Java and using the @AspectJ annotations from the AspectJ project. Spring AOP works through dynamic JDK or CGLib Proxies.

Spring AOP is explained in the

Spring 3.0.x Online Reference > 7. Aspect Oriented Programming with Spring

Note that there is an increasing tendency to replace Spring AOP with static AspectJ compilation. This Approach is explained in Section: 7.8 Using AspectJ with Spring applications

AspectJ in Action is an excellent reference for both Spring AOP and AspectJ

The pre-3.0 XML-based Spring AOP approach is explained in Appendix B. Classic Spring AOP Usage

2584 questions
0
votes
1 answer

Spring aop proxy call

I have created a spring AOP github link like below. (example1) but in my output, I see my actual method call has not been executed. as in my first joint cut, I did not invoke proceed but I was expecting the User method to be called as I called…
LowCool
  • 1,187
  • 5
  • 25
  • 51
0
votes
0 answers

Spring Around Aspect not executing on intermediate method

I am using a custom annotation and created around aspect for it. Aspect method is getting executed if it is on the service method called from controller. But if I place it on a intermediate method in service class, around aspect method is not…
Lolly
  • 34,250
  • 42
  • 115
  • 150
0
votes
0 answers

Is there a way to avoid check on few characters while using HtmlUtils.htmlEscape(String input)?

I have a use-case where I have to prevent XSS Injection at server-side. So I have made a custom annotation which can be applied on String variable, and inside the validator logic I have used HtmlUtils.htmlEscape(input) && Jsoup.clean(unsafe,…
0
votes
0 answers

Spring Sleuth - AOP Bean Creation Exception

I am trying to integrate Spring Sleuth with an existing Spring Boot application with below version. For some reason, during the start up, it;s failing to create bean with below error The BatchEnrollment class as @EnableScheduling and @Scheduled…
Shankar
  • 175
  • 2
  • 7
  • 17
0
votes
0 answers

If an exception occurs within a nested Transaction with the propagation REQUIRED_NEW, the Spring framework will perform a rollback of the transaction

I have a method annotated with @Transactional that calls a second method annotated with @Transactional(propagation=Propagation.REQUIRES_NEW), which in turn calls a third method annotated with @Transactional. If the third method throws an exception…
0
votes
0 answers

Spring custom annoatation use response body directly inside annotation

I am writing custom log handler which will log events and will be used on top of controller methods like below, @RecordEvent(authType = "EVENT", response = "", inputParams = "111") @GetMapping(value = "getRoles", produces =…
rahul
  • 406
  • 1
  • 5
  • 14
0
votes
2 answers

Is AOP supported in Helidon MP?

Like Spring framework, I want to create a Pointcut to execute some logic before executing the method. Is it possible to do that in Helidon MP? @Pointcut("execution(public * *(..))") private void anyPublicOperation(String input) {}
Newbie
  • 11
  • 3
0
votes
0 answers

BeanNameAutoProxyCreator throws java.lang.ExceptionInInitializerError

This problem is occuring when trying to load the address-validation-services.xml file in my application. I am unsure how I can fix it and am looking for some help with it. address-validation.xml code:
Calex
  • 1
  • 1
0
votes
0 answers

How to define action sequence of multiple custom annotations on a single method signature on Spring Boot

We have two custom annotations, @MerchantActivity and @Authorised. We want to execute the aspect of the @Authorised first and then the second one. But our system is automatically executing the aspect of @MerchantActivity first. How can we define…
0
votes
1 answer

AspectJ on children objects

I'm starting to work with AspectJ and I'm trying to do something that I don't know if it's possible. This is my code: public abstract class MyAbstractObject { private T myOtherObject; public T getMyOtherObject() { return…
maqjav
  • 2,310
  • 3
  • 23
  • 35
0
votes
0 answers

Custom class level annotation in spring boot

I created a custom class level annotation. Below is the aspect class: @Aspect @Slf4j @Component public class LoggingAspect { private String generateLogMessage() { return ("Entering method"); } …
0
votes
1 answer

AspectJ is not working on beans without interface and defined in the configuration class

I created a demo application to reproduce it: DemoService open class DemoService { fun test() { println("test function is executed.") } } DemoAspect @Aspect class DemoAspect { @Around("execution(*…
zqiw7
  • 3
  • 2
0
votes
0 answers

Annotation on the "second level" called method will NOT trigger the aspect

I am using spring aop to create an annotation for some crosscut purpose. Below is the sample: @Aspect @Component @Slf4j public class MyAspect { @Before("@annotation(MyAnnotationCheck)") @SneakyThrows public void check(JoinPoint…
Laodao
  • 1,547
  • 3
  • 17
  • 39
0
votes
1 answer

Spring Boot AOP nested custom annotations not called

I have created a simple custom annotation in Spring Boot that logs something and it's working but only for the first annotation, the nested one are not called import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import…
Ares91
  • 506
  • 2
  • 8
  • 27
0
votes
1 answer

Spring AOP and AspectJ. Need advice/comments on Around Advice

I posted this on another forum and wanted to see if I can reach more people. I am working on an application that consists of different Spring web apps. Say we have: ComponentA.jar ComponentB.jar And WAR files: Foo.war (contains…
Jcx Jc
  • 201
  • 4
  • 8