Skip to content

IllegalStateException: Required to bind 2 arguments, but only bound 1 (JoinPointMatch was NOT bound in invocation) #25622

@Tritpi

Description

@Tritpi

I have an application which has an aspect built using Spring AOP. In the aspect class XYZ, I have a method xyz on which the @Around advice is applied. The method xyz calls another method abc in a different class ABC, which has a @test annotation with an argument. I also have a Controller class which has methods on which there are Spring custom annotations with arguments applied. Since these controller methods are covered by the pointcut in the aspect class, it is throwing the following exception:

java.lang.IllegalStateException: Required to bind 2 arguments, but only bound 1 (JoinPointMatch was NOT bound in invocation).

Below is a snippet of how the code looks:

XYZ.java - AspectClass

@Around(pointcut())
public Object xyz(ProceedingJoinPoint pj) {
    ABC.abc(pj);
}

ABC.java -- class with annotation

@test(name="abc")
public Object abc(ProceedingJoinPoint pj) {
    pj.proceed();
}

Controller class

@customAnnotation(name="custom")
public String apiMethod(){
}

Please help understand how in such a scenario the binding of arguments can be done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions