Oracle has released Java 21, the first LTS (long term support) edition since Java 17 two years ago, while a new survey shows further growth in use of the Spring Boot framework.
New features in Java 21 include virtual threads (“Project Loom”), record patterns (“Project Amber”) and pattern matching for switch, and Sequenced Collections, described here.
Sequenced Collections address a significant weakness. “Java’s collections framework lacks a collection type that represents a sequence of elements with a defined encounter order. It also lacks a uniform set of operations that apply across such collections. These gaps have been a repeated source of problems and complaints,” the official description states.
Java 21 also previews some key new features, perhaps the biggest being the Foreign Function and Memory (FFM) API (“Project Panama”). This is easier and safer to use than JNI (Java Native Interface) for calling native methods. Although FFM API is described as “largely stable” it will not come out of preview until Java 22.
Another preview in Java 21 is the “sixth incubator” of the Vector API, first previewed in Java 16 in 2018. The Vector API, which like the FFM API is part of “Project Panama”, optimizes vector computations on supported CPU architectures, including x64 and ARM AArch64.
How long does it take for developers to adopt new versions of Java and the JDK (Java Development Kit)? In the world of enterprise development, quite a while. A new survey from the Eclipse Foundation (the home of Jakarta EE), conducted annually, states that use of Java 17 is at 36 percent, up from 26 percent in 2022, while Java 11 remains more popular at 50 percent, down from 57 percent in 2022. The survey also shows that enterprises tend to stick with the LTS releases.
Notable in the Eclipse survey, conducted between March and May this year, is that the VMWare-sponsored Spring and Spring Boot framework continues to grow, for developers of cloud native applications, at 66 percent of Java developers up from 57% in 2022. MicroProfile, a framework focused on microservices, drops from 30 percent to 26 percent. Note that Spring Boot is not an alternative to Jakarta EE, but depends upon it.
According to VMWare Spring Developer Advocate Josh Long, Java 21 “works just fine with existing versions of Spring Boot, but the real payoff will be with Spring Boot 3.2, where you’ll be able to plug in virtual threads with nary but a flick of a property, spring.threads.virtual.enabled=true.”
Spring Boot 3.2 is expected in November.
The survey also shows growing cloud adoption. 23 percent deploy more than 80 percent of their Java applications in the cloud, and 29 percent expect that to be true in two years. The top cloud provider is AWS (40 percent), followed by Microsoft Azure (30 percent) and Google Cloud Platform (20 percent).
Asked about top priorities, developers placed better Kubernetes support as number 1, followed by better support for microservices, adapting to new Java features such as virtual threads next, and improved serverless support came fourth in the list.