2,647 questions
0 votes
1 answer
105 views
How can I overload toString via annotation?
I have my custom toString that masks some fields of DTO: @Data @NoArgsConstructor @AllArgsConstructor public class Tested { private String name; private String surname; @ToString.Include(...
0 votes
1 answer
89 views
How to handle multiple exceptions that can be thrown from a @Retryable method in spring
I have a simple Service class that makes call to a third party API to create or update the record. I have 2 separate methods in my service class to make the POST and PUT call. The service class first ...
0 votes
1 answer
53 views
How can two @Aspects in Spring cooperate by sharing data?
Spring 6.2.x I would like to have two different aspects "cooperate" when they are annotated on the same method. One of them is a custom @Around aspect for Spring's own @Scheduled annotation, ...
1 vote
1 answer
96 views
How to restrict aspectj-maven-plugin to only weave aspects from a dependency and ignore local aspects in the project
I’m currently using AspectJ alongside Spring AOP in my Maven project. I want to enable compile-time weaving for aspects that are provided by a dependency (my-aspect-library) while retaining Spring’s ...
0 votes
1 answer
95 views
Cannot apply library properties in Spring Boot application
I created an Java Spring library to audit and log execution times during the execution of my application. I deployed it on SonaType and load it as a dependency in a demo project. The properties of my ...
0 votes
1 answer
50 views
Pointcut does not match target method if argNames are specified
I have an interface with implementation class being a Spring bean: public interface LeaderboardService { List<PlayerRankWithDetails> getTopScores(Long tournamentId, int limit); } For this I'...
3 votes
0 answers
251 views
Aspect Not Triggered After Restart in Spring Boot 3.4.x (But Works in 3.3.10)
In my Spring Boot 3.4.0 based application, I have an @Aspect named TenantServiceAspect that intercepts repository method calls to apply multi-tenancy filters using Hibernate filters. This aspect works ...
0 votes
0 answers
35 views
How can I test a Spring pointcut expression?
I'm writing the canonical execution time logging aspect, and I would like to test my pointcut expression. More clearly, suppose I have the following pointcut expression in an aspect @Around("...
0 votes
1 answer
75 views
NullPointerException while calling ExecutorService submit() with @Around Spring AOP
we have a aspect to log time taken by a method. Currently it is failing with NullPointerException due to aspect is passing null to ExecutorService. Is something i miss here , why null is passed to ...
0 votes
0 answers
29 views
How to control spring cloud function with aspect oriented annotations?
I have a spring cloud function that reads from kafka topic. Here's how I define the consumer as it's described here -> url Consumer @IdempotentKafkaConsumer @Bean fun readConnectionStatusEvent() : ...
2 votes
1 answer
236 views
Spring AOP Proxy Not Working with BeanPostProcessor and FactoryBean Dependencies
Description When using Spring AOP to proxy a HelloService bean in combination with a custom BeanPostProcessor (MyPostProcessor) and a FactoryBean (MyFactoryBean), the AOP proxy is not applied to the ...
0 votes
1 answer
44 views
Threads mislead the aspect's point cut logic
We have the following requirement in our micro-service architecture: Calling some of A's microservice endpoints should block calling endpoints of B's microservice. To accomplish this we have created ...
1 vote
0 answers
33 views
Spring AOP with final methods
I’m trying to implement spring aop around the commit(TransactionStatus status) method in AbstractPlatformTransactionManager class. The method is final and I understand that it isn’t possible to do ...
0 votes
1 answer
55 views
How to pause/resume some Spring AOP pointcut
In a Spring application, we added some AOP pointcuts to do intercept save, saveAll, ... methods of jpa repositories to refresh a materilized view each time the entities are inserted, updated. But, we ...
1 vote
1 answer
123 views
AOP @Aspect not triggered in @SpringBootTest
I'm using spring-boot 3.4.2. I want to use AOP aspects in order to modify annotations that I use in a spring boot test. However my @Around method is not triggered during test execution. If I annotate ...