3,707 questions
0
votes
0
answers
9
views
Multiple Aspects with Spring Boot 3.4.0
I recently upgraded Spring Boot from 3.3.0 to 3.4.0 and one of my Aspects stopped working.
My Custom aspect named @OnError(clazz =...) is added on method level and has this cutpoint:
@Around("...
0
votes
0
answers
9
views
Why Castle.DynamicProxy could not create proxy class when origin class has a decimal paramter method
Old .net framework 4.8 project, use AutoFac.
I want to use AOP to instrument every method , but some class throw exception : System.Decimal is not a supported constant type.
There are a lot of methods ...
0
votes
0
answers
21
views
I can't run LogAspect using Castle DynamicProxy
I am using an Interceptors structure created with Castle DynamicProxy in the project and I wrote a LogAspect for logging operations. However, LogAspect is not triggered in any way. I am sharing my ...
0
votes
0
answers
37
views
aspectlib: make an aspect from an instance method
I’m using Python’s aspectlib. If I try to declare an instance method as an aspect like so
from aspectlib import Aspect
class ClassAspect:
@Aspect
def instance_method{self, *args, **kwargs):
...
2
votes
1
answer
65
views
Spring AOP silently ignores pointcut errors instead of escalating them
I have one project using AOP - a sample program - which works. I created a project implementing AOP in (as far as I can see...) the same way which doesn't work.
pom.xml
<dependencies>
...
0
votes
1
answer
24
views
Getting inner methods result variable data using Spring Boot Aspect @After Advice
I am wanting to capture the data returned by a method inside of a method I am wanting to perform advice on. I want to use @After, because this method can throw exceptions, and I want to capture this ...
0
votes
0
answers
21
views
Unable to write Spring AOP logic before a method call so that based on AOP method response actual method will invoke
Below Spring boot controller method should execute based on the value returns from another AOP method
@PostMapping("/test/v1/managemtn/updatecase")
public ResponseEntity<ApiResponse>...
0
votes
1
answer
89
views
Advice of @Conditional aspect configured via XML always executing
I want to conditionally create an Aspect depending on a value read from the properties file. (It is related to profiling, that's why the intended selective use).
I have tried to create a class that ...
0
votes
1
answer
155
views
What does spring-instrument.jar do that aspectj-weaver.jar does not?
I'm trying to configure my Spring Boot application to use AspectJ load-time weaving. Using byte-buddy agent to hot-attatch the aspectj-weaver.jar seems to be working fine for both Spring beans and non-...
0
votes
2
answers
107
views
Appending screenshots or other attachments to steps of Allure report with AOP
I've been researching if it's possible to append screenshots attachments to the specific methods marked by custom @Captured annotation for the Allure reposts using AOP
I created annotation itself and ...
0
votes
0
answers
33
views
AOP @afterReturning not been called [duplicate]
I'm learning some AOP concepts and I'm using annotation @AfterReturning on a method but, this advice is not been called after returning. Rest all are working fine. please refer the code below:-
@...
1
vote
2
answers
63
views
How to add after-erroring logic on ? and returning Result
Scenario:
The codebase generally uses Result<X, E> for return types.
As we know, ? effectively converts into a return Err(e) when used.
But, I have some telemetry information that needs to be ...
0
votes
1
answer
62
views
How to resolve the error "The specified aspect 'AspectLogger' cannot be found" in AspectJ LTW setup?
I am trying to set up AspectJ load-time weaving (LTW) for logging method execution time in my Java web application. It is a webapp written using Servlets, jsp (No Spring used) and deployed on jBoss ...
0
votes
1
answer
40
views
AOP: aspect doesn't handle methods that called inside class [duplicate]
I have an interface:
public interface InputFld {
void setText(String text);
Locator getInputLocator();
}
And aspect for this interface:
@Before("execution(* com.my.project.elements....
0
votes
0
answers
35
views
@Around is not handling Feign methods
This is my gradle.build:
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.10'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.openapi.generator' version '6....
1
vote
0
answers
69
views
Custom annotation on a bean that implements an interface
Context:
spring boot: 3.3.1
spring cloud: 2023.0.2
I am trying to make a custom annotation having something like this:
@EnableAspectJAutoProxy
@Configuration
public class AspectJConfig {
}
@Target(...
1
vote
0
answers
45
views
The result of Kotlin suspend fun cannot be received from @AfterReturning in spring boot 3.2.x version
After calling the suspend func, we are post-processing the response (ex logging,...) through @AfterReturning.
Until spring boot version 3.1.12, we were able to receive and process returning value as ...
1
vote
1
answer
192
views
How to save entities previous data for audit table using AOP in Spring boot
I created AuditAspect.class to log audit details for my entities when jpa execute UPDATE and DELETE operations. When updating and deleting I expect to save previous data as a String value in my audit ...
0
votes
2
answers
50
views
AspectJ and PicoCLI does not populate properties as expected
I'm creating an annotation to attach an Aspect that would take care of authenticating an user before running a CLI command in my Spring Boot app.
Here are the components:
// The annotation
@Retention(...
0
votes
0
answers
52
views
Can Mockito @MockBean with some additional settings mock advised Spring component?
I've a simple service & aspect for it:
@Service
public class EzService {
public void ezMove() {
System.out.println("EzService#ezMove");
}
}
@Aspect
@Component
class ...
0
votes
1
answer
49
views
Spring AOP injecting a 'silent' method parameter
I'm pretty sure it's not possible to achieve this strange behaviour, but going to throw it out there ..
I want to inject a method parameter and have it available to the method code. However I do not ...
0
votes
0
answers
29
views
Inheriting annotation from an interface method to implemented methods of class [duplicate]
I'm writing an Aspect code to execute advice on a method which has particular annotation(metric in myCase) declared on top of it.
Create a custom annotation
package A;
public @interface Metric {
}
...
0
votes
1
answer
41
views
Joinpoint on method with return type Flux/Mono returns blank
I am new to reactive java and working on spring boot project. I have a method in controller class, which takes id and return Mono. its works fine and retrun response with data.But It returns blank and ...
0
votes
2
answers
97
views
Trying to Intercept a setter on a field using AOP springboot
I am trying to modify a field value while setting it. I am trying to use spring AOP. Here is my code so far
// Translate class
import java.lang.annotation.ElementType;
import java.lang....
0
votes
1
answer
97
views
Why is AspectJ Logging Not Triggering When Aspect and Interface are Annotated?
I'm looking for a way to get logging around methods.
So I've started looking at examples of Spring-AOP and AspectJ.
However, none of these seem to actually work, or at least are missing pieces in ...
0
votes
1
answer
140
views
Spring aspect on kafka listener interface
I'm trying to create aspect and process every record, that my app consumed through Kafka.
This method do not work
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import ...
0
votes
0
answers
28
views
AspectJ @Pointcut and @AfterReturning based on method annotation not being triggered
I have other ways to accomplish this, but I've never done any AspectJ so I'm trying such an approach.
I want to annotate various getters such that their results are always cast to lowercase:
@...
1
vote
1
answer
32
views
Getting an error while making the below staticInitialisation advice generic
Since the below given advice works only for a specific class
@Before("staticinitialization(org.mazouz.aop.Main1)")
I tried to make the advice generic such that it can work for any package
@...
1
vote
3
answers
1k
views
Aspects not working in spring boot application
I am creating a Spring boot application with Aspects, but it is not working. It is not getting picked up.
I have defined EnableAspectJAutoProxy in a custom configuration class.
@Configuration
@...
-1
votes
1
answer
41
views
AOP: Check if specific argument is annotated
Spring boot, AOP. I want to find out which argument is annotated with specific annotation.
I have @Aspect:
@Component
@Aspect
@RequiredArgsConstructor
public class CheckMyAop {
@Around("@...
0
votes
0
answers
47
views
How to print the caller method name as the caller name in the aspect
Why does the Aspect print the caller class name instead of the calling method name in the caller information? When attempting to print the calling method name, why does it result in a StackOverflow ...
-3
votes
1
answer
56
views
why the static variable value is printed before the system start message in the output
What specific sequence of events or method calls within the program execution led to the static variable's value being printed before the system start,thread start and type load message in the output ...
1
vote
1
answer
105
views
How can I modify my AspectJ code to work with any class?
How can I modify my AspectJ code to create a generic aspect that can be applied to any class within a package, rather than being restricted to a specific class name like "Main"?
package org....
1
vote
1
answer
160
views
@AfterThrowing advice is applied twice
Can we handle exception like try-catch construction with Spring AOP?
When some exception thrown and correspondent aspect contains two advices, with exception class and its superclass,
@AfterThrowing(...
0
votes
0
answers
91
views
How to do unit coverage reporting in php using proxy classes
In php, there are many aop packages that generate proxy classes to replace the original classes in the composer class map. I'm not sure how to properly generate a code coverage report if this is the ...
0
votes
0
answers
44
views
AOP. Application produce one GC log and crashes after specifying AspectJ as javaagent
I have main application and this application have dependency on custom lib which use AOP. And when I deploy main application I need to specify this -javaagent to make dependency work.
When I specified ...
0
votes
0
answers
58
views
Conditional Aspect Logging
I am trying to replace logging boilerplate using AOP Fody. I manually write boilerplate, which print to logs: "Method started/finished".
Simplified code:
[Conditional("DEBUG")]
...
0
votes
0
answers
30
views
how to let joinPoint proceed Wrapper which is transferred by selectOne in mybatis's baseMapper?
I define java aop for my logic. If it is the instance of Wrapper, nothing will be done extrally.
However, it thorw the exception below
nested exception is org.apache.ibatis.reflection....
0
votes
0
answers
29
views
AOP not working with internal method call [duplicate]
may be this is a duplicate question I am not sure. so please ping me if its exactly duplicate. But as far as I have searched this is little different than what is mentioned in the similar questions.
...
0
votes
1
answer
220
views
AspectJ LTW + Spring Boot + Inbuilt Tomcat Illegal access: this web application instance has been stopped already
I m trying to add aspectJ LTW integration in our Springboot Application. I m trying to use java way of specifying TomcatInstrumenatbleClassLoader and TomcatLoadTimeWeaver instead of xml way.
...
0
votes
1
answer
320
views
Inject A Spring bean into AspectJ with additional pointcuts
I have a spring boot project which already uses Spring AOP. For a new feature there is requirement to use cflow pointcut, hence AspectJ has to be integrated.
I am successfully able to Compile Time ...
0
votes
0
answers
138
views
Replace implementation of bean in spring library project
I would like to replace the implementation of all created beans of a certain class with proxy with changed logic and additional @Autowired beans there.
I have interface:
public interface Fooable {
...
0
votes
1
answer
202
views
AOP pointcut is not working with Feign client
In my project I have a Feign client extending API interface generated from OpenAPI spec:
@FeignClient(name = "customerClient", url = "${spring.microservice.tenant-service-gateway.host}&...
2
votes
1
answer
174
views
Missing argument when using @AfterReturning spring aop
Edited to provide an MCVE.
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface Random {
}
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @...
1
vote
0
answers
93
views
Aspect AOP not intercepting all methods within pointcut
I have created an aspect for the purpose of error logging and reporting within a microservices system but it is not intercepting all the methods that throw an exception within the pointcut.
import ...
1
vote
0
answers
75
views
Global transaction event handling in Micronaut 3
I want to register a global transaction before commit event handler on Application startup. What is the best way to do this?
I tried @TransactionalEventListener annotation but this requires a call to ...
0
votes
0
answers
67
views
Spring AOP: How to invoke code before transactional method invocation, but after transaction begin?
We need to perform some operations just before any transactional method invocation (insert*, update*, ...), BUT - it's important - after the transaction begin.
We used to do it for years in that way:
...
0
votes
1
answer
240
views
Spring AOP @Afterreturning aspect blocks api call
I have an @Afterreturning aspect.
@AfterReturning(value = "@annotation(****)",returning = "returnValue")
public void auditableUponReturn(final JoinPoint joinPoint, Object ...
0
votes
1
answer
71
views
AspectJ in back-end Java thread with POM based weaving [duplicate]
I have a back-end thread, which I created inside start method of JBoss Mbeans:
public interface HScannerServiceMBean {
public void create();
public void start();
public void stop();
public ...
2
votes
1
answer
308
views
What's idiomatic way to decorate set of methods in Kotlin
Python programmer getting familiar with static compilation world of java/kotlin is here. Here is a problem I'm trying to solve. I have a web-service client which provides bunch of methods to interact ...