Since 6.1 "Parameter Name Retention
LocalVariableTableParameterNameDiscoverer has been removed in 6.1."
even with -parameters in the java compiler, we are no longer able to do things like this
@CustomAnnotation(projectIdParameter = "projectId", userIdParameter = "#userEntity.id")
public ProjectEntity getProject(UserEntity userEntity, String projectId)
Because in the @Before passing in the JoinPoint, we used to be able to do
joinPoint.getSignature().getParameterNames()
However getParameterNames() is no longer available, and if you do cast getSignature to MethodSignature, getParameterNames returns null now.
What we are left to do is putting the functionality of the aspect into each method that was annotated before. We like using AOP for these security type issues, but not sure how to get it to work with the changes in Spring.
Is there anyway we can keep our AOP approach?
Then you are doing something wrong. This works just fine, both from Maven and when auto-importing the Maven project and running from IntelliJ IDEA:
Console log:
Spring Boot 3.2.3, Spring 6.1.4, JDK 21, Groovy 4.0.19.
Update:
My reproducer can be found in this GitHub repository. Branch
mastercontains the mixed Java & Groovy solution shown here, branchpure-groovythe Groovy-only variant.For the problem that parameter retention in the byte code is not imported correctly into IntelliJ IDEA, I have just created issue IDEA-348776. But that is only an IDE problem, the Maven solution above still works for both mixed Java & Groovy and pure Groovy projects.