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 is an Aspect-Oriented Programming (AOP) extension to Java, created by Xerox, that has as main components aspects (consisting of pointcuts and advices) and join points.

For AspectJ Eclipse integration, also see AspectJ Development Tools (AJDT); for NetBeans integration, see AspectJ in NetBeans; for IntelliJ IDEA integration, see IDEA Web Help.

Books:

Documentation:

3304 questions
1
vote
1 answer

Java Aspect returned value to be used in the method

I have an @After java aspect that runs certain logic. I need it to return a result (an object) that can be used in the methods intercepted by the aspect's pointcut. Is it possible?
Shai Givati
  • 1,106
  • 1
  • 10
  • 24
1
vote
1 answer

AspectJ - pattern signatures

I am studding automatic code generation (AspectJ), and I am confusing about the deference between the following pattern signatures: javax..*Model javax..*Model+ javax.*Model javax.*Model() Is this answers correct ? Method that end with Model,…
1
vote
1 answer

Kotlin compilation error: unresolved AspectJ supertype

I'm trying to use a Java library in my Kotlin project. Creating variables in my project of types defined in the library works fine, e.g. val foo: Foo = fooProvider.get(), but introducing code that actually uses these types, e.g. foo.toString(),…
mfulton26
  • 29,956
  • 6
  • 64
  • 88
1
vote
1 answer

How to package roo project without aspectj files into a jar

Hi I am using Spring Roo to create a service to access the data base, just that. so, when I try to export to a jar using eclipse, the jar not contain one java class, but these files:…
TulioPa
  • 177
  • 9
1
vote
2 answers

AspectJ module dependency with Maven - How get working the Inter-type declarations methods of a dependency module

This is my situation: I have a maven project my-project-aj-dependency composed by two jar modules: my-project-aj-dependencyJarWithAJ (where I have an Inter-type declaration, see the ahah() method below inside the aspect…
madx
  • 6,723
  • 4
  • 55
  • 59
1
vote
2 answers

Validate parameters for initial call to recursive function with AspectJ

Suppose I have the following recursive function public class MyClass{ public int foo(int arg){ ... } } I want to throw an exception in an aspect if the initial value for arg is say 10 (it's okay for it to be afterwards). I'm new to…
Frank Ibem
  • 828
  • 1
  • 11
  • 19
1
vote
1 answer

Can't login while using MultiReadHttpServletRequest with Spring security UsernameAndPasswordAuthFilter

I'm trying to build a simple logging tool that using AspectJ can print the HttpServletRequest body. For this I created a simple PointCut that catches all executions of javax Filter.doFilter, HttpServlet doPost, doGet, service etc. I then replace the…
Lin
  • 2,445
  • 5
  • 27
  • 37
1
vote
1 answer

Ctrl+click doesn't work after converting to AspectJ Project

After I enabled AspectJ nature in my SpringBoot project the CTRL + click shortcut doesn't work. When I try to use F3 I get error: CTRL + click or F3 works only on class field names (can't click class field type) or constructors. Problem is solved…
Iwo Kucharski
  • 3,735
  • 3
  • 50
  • 66
1
vote
1 answer

Aspectj expression to capture classes with specific name patterns

I need advice on writing the aspectj expression to find all classes with the class name pattern. Below is the expression I have now to capture the method servletImplementation() from the main package flow. I would like to tweak it more to do…
santosh
  • 29
  • 3
  • 12
1
vote
1 answer

Spring 3, risks of configurable annotation for injecting beans in un-managed classes?

I have a Spring 3 project which acts as a Rest API, and wanted to wire a spring bean I have into an unmanaged class for logging purposes. After trying many different things, what worked was marking my unmanaged class with the annotation…
1
vote
1 answer

AspectJ - Accessing class variable/methods values from advice?

So here´s what I wanna do: I want to log the debit method from the Account class, however, I want to log both the amount (debit parameter) AND the getAccountNumber field from the class. I´m having trouble on how do I go about to get the class…
ch1m3r4x
  • 11
  • 2
1
vote
1 answer

AspectJ ITD Generic Method Parameter Breaks Compilation

I want to introduce interfaces to XSD generated concrete classes. First I need to show the working version: public interface IBooking { T getChargesList(); void setChargesList(T value); } public aspect…
GokcenG
  • 2,771
  • 2
  • 25
  • 40
1
vote
1 answer

How do I get my custom annotation invoked using Spring?

I’m using Spring 3.2.11.RELEASE with Java 6. I’m trying to create a custom annotation but I’m having trouble getting the logic to handle it invoked. I have created this annotation package…
Dave
  • 15,639
  • 133
  • 442
  • 830
1
vote
1 answer

Logging source tcp port when ConnectException in Java?

I'm debugging a strange connection refused error thrown from my Java application (JDK 1.8.0_65). I have got Wireshark capture, but it includes both normal and error TCP segments and I have no way to distinguish which is which. I want to know if I…
stackoverflower
  • 3,885
  • 10
  • 47
  • 71
1
vote
1 answer

Validate AspectJ pointcut syntax

As the title suggest, is there any way to validate pointcut syntax using for example annotatoion processor (APT) ? It is quite easy to get value from @Pointcut(value) using APT ... But after that, there is a problem for me to validate if given…
spili
  • 61
  • 7
1 2 3
99
100