Spring / Spring Boot 4 Basics Interview Questions
What is the Java version baseline in Spring Boot 4 and what Java features does it unlock?
Spring Boot 4 maintains Java 17 as the minimum baseline while adding first-class support for Java 25. The decision to keep Java 17 as the minimum was deliberate -- as Spring Framework project lead Juergen Hoeller stated, "the current industry consensus is clearly around a Java 17 baseline."
| Java version | Support level | Notable features |
|---|---|---|
| Java 17 | Minimum required | Text blocks, records, sealed classes, pattern matching preview |
| Java 21 | Strongly recommended | Virtual threads (stable), structured concurrency (preview), sequenced collections |
| Java 25 | First-class, tested | AOT compilation improvements, GraalVM native optimisations, vector API incubator |
| Java 26 | Supported in Boot 4.1 | Structured concurrency (preview), further platform improvements |
# application.properties -- enable virtual threads (Java 21+) spring.threads.virtual.enabled=true # When enabled, Spring Boot optimises internal task executors # to use lightweight virtual threads instead of platform threads # Making blocking code perform like reactive code without complexity # GraalVM native image in Spring Boot 4 requires: # GraalVM native-image version 25 or later # Build native image: # ./mvnw -Pnative native:compile # ./gradlew nativeCompile
Virtual threads and Spring Boot 4: with spring.threads.virtual.enabled=true, the framework automatically switches internal Tomcat thread pools, Spring MVC request handling, and @Async executors to use Java virtual threads. This delivers near-reactive throughput for blocking I/O code without requiring reactive programming paradigms.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
