Cloud Native 11 min read

How Spring Native Beta Enables Fast, Low‑Memory Spring Apps with GraalVM

Spring Native beta introduces Maven and Gradle plugins that let Spring applications be compiled into GraalVM native images, delivering near‑instant startup, reduced memory usage, and container‑ready executables while outlining supported features, AOT transformation, and practical use cases for cloud‑native deployments.

Java Backend Technology
Java Backend Technology
Java Backend Technology
How Spring Native Beta Enables Fast, Low‑Memory Spring Apps with GraalVM

Spring team announced the beta of Spring Native, allowing Spring applications to be compiled into GraalVM native images.

Spring Native provides Maven and Gradle plugins and annotations to optimize native configuration.

Native Spring apps run as standalone executables without a JVM, offering near‑instant startup (<100 ms), peak performance and lower memory usage, though build time and runtime optimizations are required.

Two simple commands generate an optimized container image containing a minimal OS layer and a native executable:

mvn spring-boot:build-image
gradle bootBuildImage

Typical use cases include serverless with Spring Cloud, cost‑effective hosting of micro‑services, Kubernetes platforms such as VMware Tanzu, and creating optimal container images.

While still experimental, the beta supports a subset of the Spring ecosystem; projects using supported dependencies can try it, and issues are reported as errors or requests.

Each Spring Boot 2.x patch releases a new Spring Native version (e.g., 0.9.0 for Boot 2.4.3, 0.9.1 for Boot 2.4.4).

1. Team Collaboration

Spring Native beta results from extensive collaboration across Spring projects (Framework, Boot, Data, Security, Cloud, Initializr) and the GraalVM team to improve compatibility and resource consumption.

2. Support Scope

While still experimental, the beta supports a subset of the Spring ecosystem; projects using supported dependencies can try it, and issues are reported as errors or requests.

Each Spring Boot 2.x patch releases a new Spring Native version (e.g., 0.9.0 for Boot 2.4.3, 0.9.1 for Boot 2.4.4).

3. start.spring.io Integration

Spring Native support is now integrated into start.spring.io, automatically adding the necessary dependencies and plugins to Maven or Gradle projects.

Generated HELP.md lists useful links and flags unsupported dependencies.

4. Ahead‑of‑Time (AOT) Transformation

Native images have a fixed classpath at build time; Spring AOT plugins generate GraalVM configuration (reflection, resources, proxies) based on annotations such as @NativeHint and @TypeHint.

@NativeHint(trigger = Driver.class, options = "--enable-all-security-services", types = @TypeHint(types = {FailoverConnectionUrl.class, FailoverDnsSrvConnectionUrl.class}), resources = { @ResourceHint(patterns = "com/mysql/cj/TlsSettings.properties"), @ResourceHint(patterns = "com/mysql/cj/LocalizedErrorMessages", isBundle = true) }) public class MySqlHints implements NativeConfiguration {}

Developers can also annotate their own @Configuration or @SpringBootApplication classes to generate native hints.

@TypeHint(types = Book.class) @SpringBootApplication public class WebClientApplication { /* ... */ }

5. Conclusion

Spring’s native strategy has two pillars: making the Spring stack native‑friendly without massive changes, and collaborating with GraalVM to bridge the gap between JVM and native platforms.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavacontainerizationSpring BootgraalvmAoTSpring NativeNative Images
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.