common utility aspects to use when creating systems with [spring-aop]
Questions tagged [spring-aspects]
129 questions
1
vote
1 answer
AspectJExpressionPointcut uses wrong classLoader
I have a Java EE application consisting of multiple OSGi bundles running within Apache Felix container. One of these bundles is responsible for loading Spring application context.
I'm using Spring AOP in my application and the following error arised…

kitos
- 103
- 6
1
vote
1 answer
Spring Weaving: @Configurable objects do not get woven correctly if used as a Parameter inside Methods of Autoproxies
Please consider following situation with spring 4.0.7
For Eclipselink, we use a load-time-weaver. So we wanted to experiment with Springs @Configurable annotation using @EnableSpringConfigured with @EnableLoadTimeWeaving at the same time.
This is…

Yusuf Iskenderoglu
- 11
- 1
0
votes
1 answer
How to implement tenant key based multi-tenancy safely in Spring Boot Webflux and ReactiveMongoRepository?
I am writing a Spring Boot Webflux app which needs to be Multi-tenant. The underlying database is MongoDB and we plan on using tenantId field in each of the collections. Consequently, every query needs to be scoped with the requesting user's…

Arpan Mukherjee
- 61
- 2
- 7
0
votes
1 answer
Spring Dependency Injection with AspectJ
Currently I am reading some documentation about Quarkus in which they are constantly attacking a lot about DynamicProxy mechanism of Spring for Dependency Injection.
I am quoting
"Spring creates an implementation
proxy for the interface and any…

posthumecaver
- 1,584
- 4
- 16
- 29
0
votes
1 answer
SpringBoot 2.7: Custom Annotation Aspect not working
Below is my custom annotation SkipForTestProfile which I created to skip execution for "it" profile but the SkipForTestProfileAspect code is not execuuted, i appreciate if someone can help me fix the Aspect to execute around the annotation…

OTUser
- 3,788
- 19
- 69
- 127
0
votes
1 answer
Pointcut not working for method which throws Exception
I am trying to add Pointcut on execution of a method to total time taken by method to execute. But my pointcut is not getting called. Similar method which does not throws any exception , pointcut for that method is being called.I am not able to…

Loren
- 320
- 1
- 10
- 25
0
votes
0 answers
Spring-Aspects / Should ConfigurableDeserializationSupport have public access instead of package access?
I am running into issues with Intellij (https://youtrack.jetbrains.com/issue/IDEA-316370) and other code like the type-pollution-agent about an invalid super class for classes using @Configurable that are also Serializable.
For example, you get an…

Russ
- 1
- 2
0
votes
0 answers
Aspect pointcut doesn't work on interface
Log annotation that I created in the Aspect does not work in the method in the interface (UserService.java), but it works in the implementation class (UserServiceImpl.java). Is there a solution to…

zoroglur
- 395
- 2
- 18
0
votes
0 answers
Spring data mongodb and lazy loading proxy
With Spring data mongodb I have a couple of entities Person and Dog. Linked with DBRef, but pet property in Person can have multiple implementations and can be linked to different collections.
@Document
public class Person {
@Id
private String…

Jigar Parekh
- 6,163
- 7
- 44
- 64
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
Save Response(Json or String) to Database and Read it again
Some of my Response are kept as ResponseEntity and some as String. How should I write to the database and how should I read it? What is the best solution?
Example response
ResponseEntity
String
Entity response field
@Column(name =…

zoroglur
- 395
- 2
- 18
0
votes
1 answer
Why does not exist the AspectJBeforeAdvice class?
In Spring about AOP/AspectJ exists the MethodInterceptor interface. It is used internally to decide if an @Aspect class must be called or not - really an advice method - according with a pointcut.
About its implementations exists (see the former…

Manuel Jordan
- 15,253
- 21
- 95
- 158
0
votes
0 answers
AspectJ dep not loaded for @Timed annotation
I have exactly same symptoms like this question and I followed its accepted answer without luck.
pom.xml
org.springframework.boot
spring-boot-starter-parent
2.4.0
…

Leos Literak
- 8,805
- 19
- 81
- 156
0
votes
0 answers
Recursion in objects with Spring AOP
I've added AOP to my little SpringBoot app to log inputs and outputs of the all methods:
@Aspect
@Component
@AllArgsConstructor
public class MyAspect{
private final ObjectMapper mapper;
@Pointcut("within(com.mypackage..*)")
protected…

Paul9999
- 751
- 1
- 11
- 26
0
votes
0 answers
get value of actual parameter that has an annotation, or find parameter with the annotation
I've searched everywhere for this but the only solutions I've found relate to getting the values of the annoation, and not the parameter that is annotated.
I have an aspect that intercepts any methods annotated with a custom annotation,…

Parawata
- 41
- 3