Questions tagged [aspectj]

AspectJ is an aspect-oriented extension to the Java programming language that enables clean modularization of crosscutting concerns such as logging, error handling, standards enforcement and feature variations. Use this tag for questions about the programmatic use of this extension. For downloads, support, IDE integration, & documentation, see the "learn more" for this tag.

aspectj
Filter by
Sorted by
Tagged with
0 votes
1 answer
165 views

Aspect not being compile-time woven into target classes despite seemingly correct configuration

I have been successfully using Aspects with CTW for some time, although always for weaving code I link against, rather than code I compile. In a test project, reusing the configurations that allowed ...
Tom's user avatar
  • 114
2 votes
0 answers
41 views

Custom Annotation with AOP is affecting GetMapping annotation

I implemented a custom annotation with AOP to add on additional behavior. The usage is something as follows: @GetMapping(path="/my/path/{date}/{text}", produces = MediaType....
chunkynuggy's user avatar
0 votes
2 answers
84 views

Why a @Pointcut name method can't be overloaded?

For Spring Framework 6.0.11 about AOP, having public class CienciaPointcut { @Pointcut("execution(* com.manuel.jordan.service.CienciaService.find*(..))") public void ...
Manuel Jordan's user avatar
1 vote
1 answer
179 views

How can I setup AspectJ for a non-Spring Java 11 app built with Gradle?

For the life of me, I can't figure out how to get some AspectJ advice to run. Current Setup Java 11 Gradle 8.3 IntelliJ IDEA Ultimate NOT using Spring Attempted Config (one attempt among many) build....
MuffinTheMan's user avatar
  • 1,551
0 votes
2 answers
102 views

PointCut expressions in spring

I have two pointcut expressions: * *..*Repository.find*(..) * *Repository.find*(..) What is the difference between these two and what does the *..part of the first pointcut means?
firemancer's user avatar
0 votes
1 answer
315 views

SpringBoot restart Application with devtools, aspectj, gradle and IntelliJ

I just disvovered spring-devtools to restart the application when a class file changes. To trigger the restart i setup IntelliJ like this: Activated "Build project automatically" in "...
Janning Vygen's user avatar
-1 votes
1 answer
44 views

How does AspectJ match @annotation advice expression with an annotation even when the expression in a different case (small case)?

@Auditable(value=1) public ResponseEntity upload(@RequestParam file){ // Code } This code is using an @Auditable annotation given below: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType....
Namami Shanker's user avatar
0 votes
1 answer
46 views

Execute code after last method in method chain is executed

Can I create an aspect that will inject some code in the end of builder method chain in builder-like pattern? End-goal is to execute build method automatically inside aspect(and not necessarily build ...
crashtua's user avatar
  • 471
-1 votes
1 answer
208 views

AspectJ in Gradle - Intellij Idea

For a whole day i've been trying to use AspectJ - adding dependencies, installing plugins, creating .aj files or marking with @Aspect annotation, but nothing seems to work on gradle. Please help me to ...
pay2joy2's user avatar
0 votes
1 answer
126 views

How to autowire fields into an aspectj aspect in Springboot?

I have a Springboot service. I am using Aspectj AOP for access control. I have an aspect class AuthorizationAspect with an autowired field with some access control methods. The autowired field is ...
jnasworld223's user avatar
-1 votes
1 answer
69 views

How do I create a pointcut only matching methods with no arguments?

I am trying to only match methods with no parameters. So far, I can match any method by using something like @PointCut("execution(* * (..))") but that is too broad. I tried execution(* * ()) ...
Eisenknurr's user avatar
0 votes
1 answer
110 views

aspecj-maven-plugin, weaving dependency feature, random load java class

I use maven-aspectj-plugin in a multi modules project using maven as a dependency tool. A simple demo project, you could find here demo-project. At my real project, for the compatibiliy with lombok, I ...
Chuang Hou's user avatar
0 votes
1 answer
41 views

Add a new annotation to a member annotated itself with a specific annotation

I'd like to add an annotation to every member of a class, where the member itself is annotated with a specific annotation. I'll have to extend third-party code, to make it ready for Hibernate Second ...
kartoffel's user avatar
0 votes
1 answer
34 views

How to define a pointcut on ServerSecurityContextRepository?

I'm trying to create an aspect to execute code before ServerSecurityContextRepository.save(ServerWebExchange exchange, SecurityContext context) is called, but I couldn't get my pointcut working. Here ...
ch4mp's user avatar
  • 9,698
-1 votes
1 answer
44 views

Building a library for using AspectJ

Background We have a Java project which uses Maven as the build tool. The project structure has a Parent POM and then various Child POMs. I am working on creating a child POM project where I want to ...
user762421's user avatar
0 votes
0 answers
47 views

Compile-time weaving causing unnecessary error/exception

I'm new in using spring boot I'm currently working on a project that requires me to log the execution of a method (elapsed time and result) using aop. I can use spring-aop just fine, the problems ...
mridhoilyas's user avatar
1 vote
1 answer
50 views

AspectJ declare parents JPanel+

I would like to make a few classes extending JPanel actually extend a class of my own in between. So, I tried this: public aspect MyAspect { public static class MyPanel extends JPanel { ...
user4599075's user avatar
0 votes
0 answers
10 views

Custom AnnotationAspect doesnt get called [duplicate]

I am trying to implement a Custommade annotation that contains a value as a parameter and when the annotation is used, this value should be processed with a MDC.put. So when I use a method with the ...
Fabian Lüdicke's user avatar
0 votes
0 answers
25 views

Legacy EAR application fails on WLS14 because of AspectJ "event" pointcut

I have a legacy application that used to work on WebLogic Server 10, Java 6. Now, our customer requires us to migrate this enterprise application to WLS14. We don't have source code for the ...
usr-local-ΕΨΗΕΛΩΝ's user avatar
0 votes
1 answer
45 views

@Before doesn't allow pointcut reference, why?

I can do @Pointcut("@annotation(com.learning.validation.Validate)") public void validatePointCut() { } @AfterReturning(pointcut = "validatePointCut()") public ...
Kurian Kevin's user avatar
1 vote
1 answer
40 views

java.lang.IllegalStateException: Per-clause not recognized: pmAspect

I have a problem with the <aop:aspectj-autoproxy/> configuration tag. I have added aspectjrt.jar and aspectjweaver.jar, but my setup still is not working. <dependency> <groupId>org....
KunaRakeshKumar's user avatar
0 votes
0 answers
43 views

modify one of jira classes with aspectj

I'm trying to fix jira bug by modifying class com.atlassian.jira.issue.util.IssueImplAggregateTimeTrackingCalculator using aspectj with compile time weaving To do this I create plugin with atlassian ...
Ignat's user avatar
  • 88
0 votes
0 answers
38 views

Aspectj: why advice cannot be applied? [Xlint:adviceDidNotMatch]

I have no idea why advice cannot be applied. The aspect code seems to be correct. However, the warning message suggests that the advice defined in the LoggingAspect class is not being applied to the ...
Manav's user avatar
  • 1
1 vote
0 answers
90 views

SpringAOP and Aspectj: Aspect to get all Logger calls

I have two Java projects with Spring Boot and Maven: Backend-Client which communicates with a webservice MonitoringSystem Backend Client which is added as an external library to the first project and ...
Steppe's user avatar
  • 11
0 votes
0 answers
91 views

Wildfly 14.0 with Aspectj

I'm want to use Aspectj in project. I created helloworld basic servlet project. When I deploy my project on Wildfly 14, I don't see any logs on Wilfly 14.0 console from MyAspect class. I am not sure ...
26Boyka's user avatar
  • 21
0 votes
0 answers
623 views

How to attach @Step("My step description") annotations to allure report?

I am writing an e2e test using @SpringBootTest annotation. I am also using @Autowired test services to process logic during the test. Methods of the test services have @Step() annotation above them ...
M M's user avatar
  • 1
0 votes
1 answer
366 views

Aspect which intercept all sql queries

I have a library with aspect which scan all statement executions and doing some logic with sql sentence. @Pointcut("target(java.sql.Statement)") public void statement() {} @AfterReturning(&...
Maxim Rybalchenko's user avatar
0 votes
1 answer
145 views

How to weave hibernate by aspectj?

I have a library with aspect which scan all statement executions and doing some logic with sql sentence. @Pointcut("target(java.sql.Statement)") public void statement() {} @AfterReturning(&...
Maxim Rybalchenko's user avatar
0 votes
1 answer
33 views

Modify parseInt param before execution with @AspectJ

I'm using spring boot 3.1.0 with org.springframework.boot:spring-boot-starter-aop I can't make the aroundParseInt aspect to trigger. I do another aspect test (test1) and this one is triggering. What I ...
Isaachjk's user avatar
  • 103
0 votes
0 answers
86 views

AspectJ weaving does not happen outside of gradle module

I have created an annotation and an aspect in a multi module gradle project. My annotation works if I apply it to a test that lives in the same module as the aspect and annotation, but the aspect is ...
rcgeorge23's user avatar
  • 3,644
1 vote
0 answers
95 views

unable to create bean error with name 'entityManagerFactory' bean

I'm using JDK 1.8 MySQL 8.0.31 Spring version 5.3.27 Aspectj version 1.8.10 log4j-api(core, web) version 2.17.1 updating the log trace May 17, 2023 12:16:20 PM org.apache.catalina.core....
rob's user avatar
  • 21
0 votes
0 answers
178 views

AspectJ @Around is not working in multi-module project

I have simple Gradle Spring Boot project with following approximate structure: myproject ├───core │ └───src │ │ └───EntryDescription.java │ └───build.gradle ├───core-web │ └───src │ │ └──...
Clayn's user avatar
  • 27
0 votes
1 answer
39 views

Call adviced method from around advice and avoiding infinite loop without using cflow

I want to capture all method executions in com.ABC.MyClass using AspectJ package com.ABC public class MyClass{ public methodA(){ } public methodB(){ ...
komal Thawani's user avatar
1 vote
1 answer
66 views

AspectJ doesnt work properly in Spring project

I have my spring project (Not Spring Boot) I turned on aspect with <aop:aspectj-autoproxy /> After I did it I have odd behaviour with my @PersistenceContext and @Transactional annotations. When ...
Volodymyr Bilovus's user avatar
0 votes
0 answers
18 views

AspectJ Declaring Annotation with various Parameter values dependent on the method?

I want to create an aspect, to declare some annotations to some methods, but with an variable parameter. Annotation: @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) @Retention(RetentionPolicy....
Ti1991's user avatar
  • 1
0 votes
1 answer
313 views

How to intercept nested method call with same annotation configured using Spring AOP or AspectJ?

I have configured multiple database following this link https://fable.sh/blog/splitting-read-and-write-operations-in-spring-boot/. DB call is routed based on the Transactional annotation value. Call ...
Harsh Kanakhara's user avatar
1 vote
2 answers
379 views

How can I implement nested logging within a Spring component with AspectJ?

I'm working on a Spring Boot Gradle project with Java, where logging is done manually in every function that needs to be logged. In each function that requires logging, a new instance of a custom ...
Norbert Maszlag's user avatar
0 votes
1 answer
534 views

Problem running AspectJ Load-Time-Weaving with java command

I am trying to run and test the aspectJ load time weaving. It compiled successfully. javac -cp "lib/*" -d classes src/*.java While running the program, the output is only Hello. Sadly, ...
Bishal Thapa's user avatar
0 votes
1 answer
363 views

Getting error error at ::0 formal unbound in pointcut while accessing annotation value inside an advice using ApectJ

I'm trying to access custom annotation value inside an advice method but getting an error Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org....
Pavan's user avatar
  • 3
0 votes
0 answers
29 views

Can we use AspectJ API to weave a .class file by a .aj file at runtime?

Basically, I want to create a .java file which can take as input the path to the .class file and name of methods to be logged. Using the aspectJ, we should save the weaved .class file having logs. Is ...
Shahnawaz Khan's user avatar
0 votes
0 answers
11 views

Configuring Hibernate session methods with Spring AOP [duplicate]

I have a java EE , spring application that uses Hibernate 3. I want to calculate the execution time of queries, so I am trying to intercept hibernation session and query methods to calculate the ...
kiran 05's user avatar
0 votes
1 answer
1k views

AspectJ Maven Plugin wont compile my project after upgrading to java 11

I am trying to upgrade a project from java 8 to 11. I have updated the pom but i get an error about aspectJ not being able to compile it when running the build. Here is the error i get below. [ERROR] ...
dynamo's user avatar
  • 303
-1 votes
1 answer
244 views

org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor called, but no retry [closed]

I have a @Retryable(maxAttempts = 3, value=Exception.class, backoff = @Backoff(delay = 500)) set up over the method, method is called from another class, so ApsectJ works here properly, and @...
Eljah's user avatar
  • 4,632
0 votes
1 answer
87 views

How to intercept meta annotations (annotated annotations) in Spring AOP.In other words, how to use aspectj syntax to match meta-annotation on method [duplicate]

This problem has been solved partly before,The question I asked builds on the answer to this question reference: How to intercept meta annotations (annotated annotations) in Spring AOP related codes ...
White's user avatar
  • 1
4 votes
1 answer
2k views

After updating to java 17 started to receive [error] target level should be in '1.1'...'1.8','9'...'14': 17

I updating my test framework to use Java 17, using Gradle. java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } } Also upgraded Gradle to '8.0.2' version. Trying to ...
captain D's user avatar
0 votes
1 answer
109 views

How to change pointCut expression inside an aspect which has been compiled when I use this aspect in other project?

I have a logging aspect like this, it will print args, result or any other exceptions. I use aspectj-maven-plugin to compile this aspect. Then, the compiled result will be packaged to a jar. I will ...
Chuang Hou's user avatar
0 votes
1 answer
132 views

Cannot run ajc compiled class file in the terminal using Java

I trying to learn aspectj for a project. I wish to run the java files from the terminal using ajc and java but I am unable to do so. I have 2 files in my directory HelloWorld.java and HWTracer.aj ...
Dunkan's user avatar
  • 3
1 vote
0 answers
70 views

AspectJ Load Time Weaving For Any Minecraft Forge Mod Installed

Context: I've been working on a fork for the RecipeStages mod https://github.com/DrainBread/RecipeStages/tree/1.16 The purpose of my modification is to allow this mod to work with any other mod that ...
JohnCesario's user avatar
0 votes
0 answers
50 views

Integrate aspectj-maven-plugin in bazel

Ive got a blocker, I am not able to integrate the plugin above in bazel. I have been investigating,how to deal with it (threads, chatGpt). But I found repositories and information outdated. Exactly, I ...
user avatar
1 vote
1 answer
261 views

Need to exclude AspectJ closure classes from Jacoco coverage

We need to use AspectJ compile time weaving and that is creating the AjcClosure classes. Somehow the package weaving is not working for us. We need to exclude these AjcClosure classes from the ...
tarini sunil's user avatar

1
2
3 4 5
67