Migrate Spring Cloud Azure Native Configuration to Spring Framework 6 hints
Spring Native, the experimental native support project for Spring Boot 2.x applications that I lead, will be replaced by Spring Boot 3 official native support once released November 24th.
Spring Cloud Azure Native Configuration currently leverages Spring Native hint annotations like @NativeHint, @TypeHint, etc. I propose to replace it by Spring Framework 6 and Spring Boot 3 hints.
We have not yet written the documentation, but you should be able to leverage Spring Framework 6.0.0-M6 and add RuntimeHintsRegistrar implementations that allows to register hints via a programmatic API. You can take inspiration of existing implementations provided with Spring Framework. Those implementation are discovered via META-INF/spring/aot.factories resource files like this one.
You can add basic tests on JVM side like this. We are also in the process of adding native test support which can be useful for proper integration testing but that can comes later IMO.
Happy to provide guidance and help for that migration.
@sdeleuze thanks for reaching out. We are currently preparing Spring Cloud Azure support for Spring Framework 6 on branch https://github.com/Azure/azure-sdk-for-java/tree/feature/spring-cloud-azure-6.x. We'll try RuntimeHintsRegistrar. Does this mean the Spring Cloud Azure Native Configuration project won't be needed anymore in SF6/SB3?
You could indeed remove https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring-experimental/spring-cloud-azure-native-configuration which lives in spring-experimental and instead add Spring Boot 3 native support via RuntimeHintsRegistrar implementations + their META-INF/spring/aot.factories counterparts in https://github.com/Azure/azure-sdk-for-java/tree/feature/spring-cloud-azure-6.x/sdk/spring.
When Spring Framework 6 and Spring Boot 3 will be GA (late november), Spring Native users will be asked to migrate to those official release so there won't be a need to support it anymore.
Just an update: The next milestone is planned to fix this.
Hi @sdeleuze, I am about to implement this feature request. I have a question: how should we ensure that all resources/reflections/proxies in our code have been registered via the RuntimeHintsRegistrar?
Hi, you can take advantage of RuntimeHintsPredicates, see for example an example of such test in TomcatWebServerRuntimeHintsTests.
Our current plan is to use a separate module, spring-cloud-azure-native-reachability to support the Spring Native for Spring Boot 3. See https://github.com/Azure/azure-sdk-for-java/pull/33055. This module is not GA-ready, but when it comes to GA, the source code of this module will be integrated into each Spring Cloud Azure library.