If a configuration class implements ImportAware and EmbeddedValueResolverAware, the setEmbeddedValueResolver method is invoked first, and then setImportMetadata 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:
2022-08-02T11:09:00.042-03:00 INFO 94512 --- [ main] com.example.MyConfig : Setting resolver org.springframework.beans.factory.config.EmbeddedValueResolver@7a138fc5
2022-08-02T11:09:00.043-03:00 INFO 94512 --- [ main] com.example.MyConfig : Setting import metadata org.springframework.beans.factory.config.EmbeddedValueResolver@7a138fc5
When running native or AOT-optimized (notice that resolver is null):
2022-08-02T11:07:41.389-03:00 INFO 94483 --- [ main] com.example.MyConfig : Setting import metadata null
2022-08-02T11:07:41.389-03:00 INFO 94483 --- [ main] com.example.MyConfig : Setting resolver org.springframework.beans.factory.config.EmbeddedValueResolver@68d0f8c8
If a configuration class implements
ImportAwareandEmbeddedValueResolverAware, thesetEmbeddedValueResolvermethod is invoked first, and thensetImportMetadatais second.When the application is compiled to native or running in AOT mode, the order of the method invocation switches, causing the
setImportMetadatato 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):