About Spring AOP working with Context Selection Pointcuts as follows:

@Aspect
@Component
@Profile("aop-before")
class LoggingCienciaAspectBefore {

    @Before("execution(void com.manuel.jordan.service.CienciaService.delete(int)) " +
            "&& target(cienciaService) && this(proxy) && args(id)")
    void beforeAdvice(JoinPoint jp, CienciaService cienciaService, Object proxy, int id) {
           ...
        }

}
````

So far with Spring Framework **6.0.18** and with AspectJ 1.9.19, all work fine

**But** with Spring Framework **6.1.5** and with AspectJ 1.9.19 fails at runtime as follows:

Apr 09, 2024 8:57:37 AM org.springframework.context.support.AbstractApplicationContext refresh WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appConfig': BeanPostProcessor before instantiation of bean failed [WARNING] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appConfig': BeanPostProcessor before instantiation of bean failed at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:975) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:962) at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:624) at org.springframework.context.annotation.AnnotationConfigApplicationContext. (AnnotationConfigApplicationContext.java:93) at com.manuel.jordan.main.Main.main (Main.java:25) at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279) at java.lang.Thread.run (Thread.java:833) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': BeanPostProcessor before instantiation of bean failed at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod (ConstructorResolver.java:409) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod (AbstractAutowireCapableBeanFactory.java:1335) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance (AbstractAutowireCapableBeanFactory.java:1165) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:562) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:205) at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans (BeanFactoryAdvisorRetrievalHelper.java:91) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors (AbstractAdvisorAutoProxyCreator.java:111) at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors (AnnotationAwareAspectJAutoProxyCreator.java:92) at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip (AspectJAwareAdvisorAutoProxyCreator.java:101) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation (AbstractAutoProxyCreator.java:280) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation (AbstractAutowireCapableBeanFactory.java:1130) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation (AbstractAutowireCapableBeanFactory.java:1105) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:511) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:975) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:962) at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:624) at org.springframework.context.annotation.AnnotationConfigApplicationContext. (AnnotationConfigApplicationContext.java:93) at com.manuel.jordan.main.Main.main (Main.java:25) at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279) at java.lang.Thread.run (Thread.java:833) Caused by: org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer$AmbiguousBindingException: Still 2 unbound args at this()/target()/args() binding stage, with no way to determine between them at org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer.maybeBindThisOrTargetOrArgsFromPointcutExpression (AspectJAdviceParameterNameDiscoverer.java:488) at org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer.getParameterNames (AspectJAdviceParameterNameDiscoverer.java:255) at org.springframework.core.PrioritizedParameterNameDiscoverer.getParameterNames (PrioritizedParameterNameDiscoverer.java:55) at org.springframework.aop.aspectj.AbstractAspectJAdvice.bindArgumentsByName (AbstractAspectJAdvice.java:434) at org.springframework.aop.aspectj.AbstractAspectJAdvice.calculateArgumentBindings (AbstractAspectJAdvice.java:389) at org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.getAdvice (ReflectiveAspectJAdvisorFactory.java:303) at org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl.instantiateAdvice (InstantiationModelAwarePointcutAdvisorImpl.java:152) at org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl. (InstantiationModelAwarePointcutAdvisorImpl.java:116) at org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.getAdvisor (ReflectiveAspectJAdvisorFactory.java:213) at org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory.getAdvisors (ReflectiveAspectJAdvisorFactory.java:144) at org.springframework.aop.aspectj.annotation.BeanFactoryAspectJAdvisorsBuilder.buildAspectJAdvisors (BeanFactoryAspectJAdvisorsBuilder.java:110) at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors (AnnotationAwareAspectJAutoProxyCreator.java:95) at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip (AspectJAwareAdvisorAutoProxyCreator.java:101) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation (AbstractAutoProxyCreator.java:280) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation (AbstractAutowireCapableBeanFactory.java:1130) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation (AbstractAutowireCapableBeanFactory.java:1105) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:511) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod (ConstructorResolver.java:409) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod (AbstractAutowireCapableBeanFactory.java:1335) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance (AbstractAutowireCapableBeanFactory.java:1165) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:562) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:205) at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans (BeanFactoryAdvisorRetrievalHelper.java:91) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors (AbstractAdvisorAutoProxyCreator.java:111) at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors (AnnotationAwareAspectJAutoProxyCreator.java:92) at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip (AspectJAwareAdvisorAutoProxyCreator.java:101) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation (AbstractAutoProxyCreator.java:280) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation (AbstractAutowireCapableBeanFactory.java:1130) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation (AbstractAutowireCapableBeanFactory.java:1105) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:511) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:326) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:324) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:200) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:975) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:962) at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:624) at org.springframework.context.annotation.AnnotationConfigApplicationContext. (AnnotationConfigApplicationContext.java:93) at com.manuel.jordan.main.Main.main (Main.java:25) at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279) at java.lang.Thread.run (Thread.java:833) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.088 s [INFO] Finished at: 2024-04-09T08:57:37-05:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project spring-framework-aop-d: An exception occurred while executing the Java class. Error creating bean with name 'appConfig': BeanPostProcessor before instantiation of bean failed: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': BeanPostProcessor before instantiation of bean failed: Still 2 unbound args at this()/target()/args() binding stage, with no way to determine between them -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


The most important part of the error stack trace is located almost in the bottom, it is (split in many lines for presentational purposes):

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project spring-framework-aop-d: An exception occurred while executing the Java class. Error creating bean with name 'appConfig': BeanPostProcessor before instantiation of bean failed: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': BeanPostProcessor before instantiation of bean failed: Still 2 unbound args at this()/target()/args() binding stage, with no way to determine between them -> [Help 1] [ERROR] ```

It happens even if AspectJ is upgraded to 1.9.22. Again works fine with SF 6.0.18 and fails with SF 6.1.5 - cleaned and compiled again.

Just in case, it is working with Java eclipse/temurin jdk-17.0.8+7

Thanks for your understanding

Comment From: snicoll

So far with Spring Framework 6.0.18 and with AspectJ 1.9.19, all work fine

Does it work fine with no warnings in the log at all? I am expecting some warning about the lack of -parameters. If you don't see any warning with 6.0.x then please share a small sample we can run ourselves. Again, a code snippet is not actionable.

If you see a warning in 6.0.x, then please review the upgrade notes, this section in particular and report back.

Comment From: manueljordan

Yes, I remember that kind of warning message was shown many times with SF 6.0.x, but because the app works fine was ignored.

Thanks for the link about that Maven configuration. Let me test it, if the app is not working even with that addition I am going to share a simple sample app.

Comment From: snicoll

Yes, I remember that kind of warning message was shown many times with SF 6.0.x, but because the app works fine was ignored.

Ugh. The very purpose of a warning is to warn you that, while the app continues to work, it may not do so in the future. Please reconsider how you treat this in the future.