AOT and Native Image Support
自 4.0.0
起,Spring Cloud Config Server 支持 Spring AOT 变换。自 4.1.0
起,它还支持 GraalVM 原生映像,但是它要求用户为已知的 GraalVM 问题添加一些变通方案,如下所述。
- IMPORTANT
-
Due to [a bug]([role="bare"]https://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
刷新范围不受本机映像支持。如果您打算以本机映像形式运行 Config 客户端应用程序,请确保将 spring.cloud.refresh.enabled
属性设置为 false
。