Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Doc: AsyncConfigurer causes dependencies to be created early [SPR-16945] #21484
The issue is that this dependency causes the bean (and all its dependencies) to be created very early - at the time when BeanPostProcessors are registered. That prevents these beans to be processed (e.g. by AspectJ processors).
This happens because ProxyAsyncConfiguration finds the AsyncConfigurer and causes this config to be created along with its dependencies, when other processors are not available yet.
For workaround, one can often annotate the bean dependency in the config as
After lengthy investigation why my beans are not CGLIB-proxied I've found this cause. Having learned how the ProxyAsyncConfiguration is bootstrapped I no longer find this behavior surprising. But if this was stated somewhere in the JavaDoc at least I'd have more hair on my head at this moment.
You can see the referenced PoC on GitHub for more details.
Affects: 4.3.18, 5.0.7
Reference URL: https://github.com/stuchl4n3k/spring-async-configurer-issue
Backported to: 4.3.19