-
Notifications
You must be signed in to change notification settings - Fork 182
AOT transformations and native image support
As of 2022.0
, most of the Spring Cloud projects support Spring Boot's ahead-of-time transformations, as well as building and running Spring Cloud components as native images. However, there are some limitations, as listed below.
Refresh Scope is not supported for any Spring Cloud applications in AOT and native image. The spring.cloud.refresh.enabled
flag needs to be set to false
.
Spring Cloud Config Server is blocked by graal#5134 and will likely require the completion of the work on https://github.com/graalvm/taming-build-time-initialization to be fixed.
Spring Cloud Config Client is supported for AOT and native image, however, the user must ensure that the configuration data source that it connects to (such as, Spring Cloud Config Server, Consul, Zookeeper, Vault, etc.) is available at build time. In order to avoid unexpected behaviour, any properties that would influence bean creation (such as the ones used within bootstrap context) should be set to the same values at build time and runtime. Since Config Client connects to a running data source (such as Config Server) while starting up from native image, the quick startup time will be slowed down by the time required for this network communication to take place.
The legacy config processing (Config First Bootstrap) mode does not support AOT or native images.
In order for load-balancing to work with AOT and native images, all the LoadBalancerClient service IDs have to be explicitly defined by the user. However, to use this feature. It can be done by using the value
or name
attributes of the @LoadBalancerClient
annotation or as values of the spring.cloud.loadbalancer.eager-load.clients
property.
Spring Cloud Netflix Eureka Server does not support AOT or native images.
Spring Cloud Stream has a component called StreamBridge
which is effectively a template to send messages - messages that can be represented as Spring Message as well as any primitive or POJO. For example streamBridge.send(“myQueue”, “Hello stream”)
or streamBridge.send(“myQueue”, new Foo())
. The issue is that we do not know what user may send and thus can not introspect it which means the user would need to know the types they may be sending and add them as hints via @RegisterReflectionForBinding(Foo.class)
.
At this point, Spring Cloud Kubernetes does not support Spring Boot AOT transformations or native images. Partial support might be added in future releases.
To utilize Spring Cloud Task’s single instance feature when creating a natively compiled app, the feature needs to be enabled at build time. This is done by adding the process-aot
execution and setting the spring.cloud.task.single-step-instance-enabled=true
as a JVM argument.
Single Step Batch Job reader and writer selection needs to be specified at build time.