-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different order of invocations for ImportAware and EmbeddedValueResolverAware with AOT-optimized contexts #28915
Comments
This comment was marked as outdated.
This comment was marked as outdated.
Answering to self, I can reproduce the problem with AOT on the JVM so it isn't native specific. I've updated the title accordingly. |
OK I figured it out. Both pieces share the same callback |
The order is restored. Thank you very much for the report and the sample @marcusdacoregio! |
That custom code broke the native use case as it's using reflection without a hint. |
This was fixed in 3a89003 |
This commit updates ImportAwareAotBeanPostProcessor to be priority ordered, with the same order as its original BeanPostProcessor. This makes sure that infrastructure beans can be post-processed if necessary See gh-28915
If a configuration class implements
ImportAware
andEmbeddedValueResolverAware
, thesetEmbeddedValueResolver
method is invoked first, and thensetImportMetadata
is second.When the application is compiled to native or running in AOT mode, the order of the method invocation switches, causing the
setImportMetadata
to be invoked first.This is causing some problems here in Spring Session
Sample
https://github.com/marcusdacoregio/embedded-value-resolver-aware-native
When running in the JVM:
When running native or AOT-optimized (notice that resolver is null):
The text was updated successfully, but these errors were encountered: