Questions tagged [spring-aspects]

common utility aspects to use when creating systems with [spring-aop]

129 questions
3
votes
1 answer

Storing old and new value in mongoDb using Spring AOP

I am new to Spring AOP world. I am trying to build the Spring boot logging using AOP. I have created the collection in MongoDB named "Audit report" which is storing old and updated value of object. I am using @Before and @After Annotations of Spring…
Ni3
  • 107
  • 1
  • 12
3
votes
2 answers

Spring AOP: How exclude an unnecessary @Pointcut (@Around advice) execution due the execution from others @Pointcuts/advices

I am working with: Spring Framework 4.3.3 AspectJ 1.8.9 I have the following normal process: @Controller -> @Service -> @Repository I have the following pair about AOP: PersonaServicePointcut PersonaServiceAspect The scenario is the…
Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
3
votes
3 answers

Why can't @PostConstruct and @Retryable be used together?

I have created a spring framework based application using AnnotationConfigApplicationContext. One bean has an init method which creates a connection to an external service. This can be annotated with @PostConstruct to run automatically once the…
UserF40
  • 3,533
  • 2
  • 23
  • 34
3
votes
1 answer

Spring Boot, @Configurable LoadTimeWeaving, Tomcat 8 - IllegalStateException

In my Spring Boot 1.3.3, Tomcat 8(Embedded for development, Standalone for production) application I'm going to move away from Spring Proxy Transactional Mode to AspectJ transactions. I have added a following application…
alexanoid
  • 24,051
  • 54
  • 210
  • 410
3
votes
2 answers

AOP using AspectJ not working with

I am new to spring framework and was trying some sample examples to understand the AOP and here is what I did till now, but its not working. The problem is as soon as I add to spring.xml my build fails saying not able to…
786543214
  • 855
  • 4
  • 14
  • 29
3
votes
3 answers

Java AOP JoinPoint does not get parameter names

I'm using Java Spring Mvc and Spring AOP to find the parameter names from the user. I have a controller which get parameters from user and call a service. I have an aspect that running before the service. The aspect should check if username and…
ork
  • 209
  • 3
  • 9
  • 17
2
votes
1 answer

Cannot catch exception thrown in @Before advice in @AfterThrowing advice

I am using @Before and @AfterThrowing Spring AOP advices. In the before advice, I am validating data and throwing user-defined exceptions upon validation failure. As I already defined an @AfterThrowing, I am expecting this will catch the error to…
Vineel Pellella
  • 332
  • 2
  • 4
  • 20
2
votes
0 answers

How to access Jersey's contextual objects in an aspect when using Spring?

I am working with Spring 5.2.x together with Jersey 2.30.x for JAX-RS. I have an annotation as following: @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface MyAnnotation { } In my…
user8870331
2
votes
1 answer

Spring AOP - @AfterReturning does not work

I have a Java method, getAllItems(), and I created an aspect method, which is called after getAllItems() ends. @Repository @Scope("prototype") public class ItemDao { // not using database connection for this question; the program works fine,…
Catalin Vladu
  • 389
  • 1
  • 6
  • 17
2
votes
1 answer

How to mask any parameter inside auto generated swagger java class

How to mask any parameter in auto generated swagger java class ? If manual getter setter class we can edit toString method but in autogenerated class it will generate swagger pojo class on each build so how to modify toString method which is…
ojus kulkarni
  • 1,877
  • 3
  • 25
  • 41
2
votes
1 answer

Spring MVC and AOP: @Pointcuts for @Controllers only works in Testing and not for Production

I am working with Spring Framework 4.3.3 in a Web Environment: I have two contexts: RootApplicationContext ServletApplicationContext I know the ServletApplicationContext contains all the beans about the web side, for example @Controller.…
Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
2
votes
0 answers

Spring AOP Proxy Issues while using Pointcut with javax.sql.DataSource.getConnection(..)

I am trying to set ClientIdentifier value by invoking DBMS_SESSION.SET_IDENTIFIER('XXXX') procedure after getting DB connection. To implement this I have used Spring AOP aspects as explained in link: …
Amar
  • 43
  • 5
2
votes
1 answer

Missing CSFR_TOKEN session attribute after login process in Spring Security with Angular JS

I have an issue with Spring Security with AngularJS using CSRF. My implementation is based on this documentation: http://spring.io/guides/tutorials/spring-security-and-angular-js/ My issue is that login/logout process are not managed correctly. The…
Alessandro C
  • 3,310
  • 9
  • 46
  • 82
2
votes
1 answer

Spring AOP doesn`t work with class comprising @Transactional method

I develop web-app, with a need to store heavy-weight files and use Apache FTP Server for this purpose. When a new user register his account, the folder named as his username must be created on remote server. To establish connection, before…
Wolf Larsen
  • 105
  • 6
2
votes
0 answers

How to make an aspect detect a method with multiple annotations

I have a spring application and I want to use aspects to perform some performance logging. I want to only log methods annotated with @Measured, so I created an annotation as follows…
Wael Awada
  • 1,506
  • 3
  • 18
  • 31
1
2
3
8 9