AOT and Native Image Support

Since 4.0.0, Spring Cloud Config Server supports Spring AOT transformations. As of 4.1.0 it also supports GraalVM native images, however it requires the user to add some workarounds for known GraalVM issues, as described below.

IMPORTANT

Due to [a bug](github.com/oracle/graal/issues/5134) in Graal’s FileSystemProvider a configuration workaround needs to be added to allow the Config Server to run as a native image. You will need to add the following options to your GraalVM build plugin setup (please refer to GraalVM Maven or Gradle plugin documentation for more details):

-H:-AddAllFileSystemProviders
--strict-image-heap
--initialize-at-build-time=org.bouncycastle
--initialize-at-build-time=net.i2p.crypto.eddsa.EdDSASecurityProvider
--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG$Default
--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV
NOTE

Adding the additional build time initializations can affect performance, but it still may offer gains as compared to a regular JVM run. Make sure to measure and compare for your application.

TIP

If you are connecting with your config data backend over SSH, keep in mind that GraalVM requires security provider registration using java.security

Refresh scope is not supported with native images. If you are going to run your config client application as a native image, make sure to set spring.cloud.refresh.enabled property to false.