How to Build Java Applications Today #70
Spring Boot 3 brings Java 17, Jakarta EE 9, and native Java with GraalVM, Spring Modulith structures Spring Boot 3 applications with modules & events, and a new UI in IntelliJ 2022.3.
Welcome to my newsletter “How To Build Java Applications Today”! If you like it, then subscribe to it for free on Substack! Or read it on dev.to or Medium. Even better: Share it with people who are interested!
In this newsletter, I recommend IDEs, build tools, JVM languages, databases, back-end frameworks, web frameworks, and mobile app frameworks. I also cover essential releases and news.
This report is different because it measures popularity by observing what all Java developers do: job ads from 62 countries, online training students, Stack Overflow questions, and Google searches. My recommendations are based on that popularity, industry analysis, and my 23 years of Java experience.
Why popularity? Because picking a popular technology makes our developer life easier: easier to learn, easier to build, debug & deploy, easier to find jobs/hire, and easier to convince teammates & bosses. Now popularity can make a difference in two situations: When multiple technologies score similarly, we could go for the mostpopular one. And when a technology is very unpopular, we may not use it.
It was just three weeks ago that I gave my last talk of the year. And Munich has the best conference food, hands down. 😋 But I’m already booked again: Like this year, I’ll talk again at the two largest Java conferences in Germany! 😃 Both times, it’s about whether native Java, statically compiled ahead of time with GraalVM Native Image, is worth the effort. So I hope to see you either at JavaLand in March or at JAX Mainz in May!
Last month, I told you I had several InfoQ articles and news items in the pipeline that “should all be out before our next issue”. As usual in life, things take longer. My news item on Spring Framework 6 and Spring Boot 3 is out, as is my interview with Java Champion and original Spring developer advocate Josh Long. And my news item & interview with Oliver Drotbohm on Spring Modulith got published, too! As usual, I’m working on other things I hope you’ll see in the next issue.
Essential tool & technology releases: Last month, Gradle, IntelliJ, VS Code, Spring Boot, and Quarkus had major releases. Spring Boot, Quarkus, and Micronaut also had minor releases.
New & Noteworthy
Spring Boot 3: Java 17, Jakarta EE 9, and Native Java with GraalVM
VMware released Spring Framework 6 and Spring Boot 3. After five years of Spring Framework 5, these releases start a new generation for the Spring ecosystem. Spring Framework 6 requires Java 17 and Jakarta EE 9 and is compatible with the recently released Jakarta EE 10. It also embeds observability through Micrometer with tracing and metrics. Spring Boot 3 requires Spring Framework 6. It has built-in support for creating native executables through static Ahead-of-Time (AOT) compilation with GraalVM Native Image.
The originally planned support for the Java Platform Module System (JPMS) in Spring Framework 6 did not ship, as Spring focused on AOT compilation with GraalVM Native Image this time. It’s unclear if and when Spring will support JPMS.
Spring Boot 3.0 has a migration guide. It suggests upgrading to Spring Boot 2.7 first before moving to Spring Boot 3.0.
I also interviewed Java Champion and original Spring Developer Advocate Josh Long on this topic. There, Josh tells us why Spring Framework 6 took so long, why he loves reactive programming, and which Spring project he’d like to see resurrected.
Spring Modulith Structures Spring Boot 3 Applications with Modules and Events
VMware has introduced an experimental project, Spring Modulith, to better structure monolithic Spring Boot 3 applications through modules and events. Despite the name suggesting otherwise, we can use this framework for any Spring Boot project, including microservices. I had the chance to interview the author of this Spring project for my news item.
The project introduces new classes and annotations but doesn’t generate code. Its modules don’t use the Java Platform Module System (JPMS) but instead map to plain Java packages. Modules have an API, but Spring Modulith encourages using Spring application events as the “primary means of interaction.” These events can be automatically persisted in an event log. Spring Modulith also eases the testing of modules and events.
A New UI in IntelliJ 2022.3
JetBrains announced a new UI for its products, including IntelliJ, in May this year. Now that new UI isn’t the Visual Studio Code clone “Fleet” they announced a year ago — that’s separate (though Fleet also uses the new UI).
With IntelliJ 2022.3, we can now test the new UI. I took a brief look and immediately went back: Rearranging where to find the existing functionality is less appealing to me, as I know where everything is already. JetBrains held a webinar on the new UI, demoing and explaining it.
The good news for people like me: The old UI will remain in IntelliJ “for at least a year after the new UI becomes the default.” So we all have some time to get used to the new UI!
A Garbage Collection Refresher
We all know that there’s garbage collection in Java so that we developers don’t have to reserve and release memory manually. Wonderful! But how does that work exactly? Here are the two main ideas.
- Garbage collectors do one or more of these four activities: Mark labels all objects still in use as “live”. Sweep clears all non-live objects. Compact brings live objects closer together, so bigger memory blocks are available. And copy moves all live objects to a “to” space, while non-live objects remain in a “from” space.
- When selecting a garbage collector, you can pick at most two of three benefits: very low latency, very high throughput, and lowest CPU and memory usage.
The article tells us more. 😃
Technology Index (Last Update: October 2022)
- Popularity trend: Eclipse is the most popular Java IDE, though it has declined over many years. IntelliJ holds up well for a commercial product: Except for job ads, it’s neck-to-neck with Eclipse. NetBeans is the least popular IDE. VS Code isn’t a fully fledged Java IDE, but — apart from jobs — it’s 3–4 times as popular as Eclipse & IntelliJ.
- If you don’t want to spend money, then use Eclipse.
- If you may spend money, evaluate IntelliJ.
- Evaluate VS Code for non-Java work, like web development (I use it for all my websites).
- If you’re using NetBeans, consider moving off of it.
- Popularity trend: Maven is 2.5 times as popular as Gradle, except for Stack Overflow, where Gradle is slightly ahead of Maven. Ant and sbt have declined for years.
- If you use Scala, then use sbt.
- Otherwise, if you absolutely cannot stand XML files and/or need to customize your build heavily, then use Gradle.
- Otherwise, use Maven.
- On your current project, keep your existing language unless that language is absolutely, really not working out for you.
- If you need to switch languages or are on a new project:
- Use Scala if you need functional programming.
- Use Kotlin if you really need a “more modern Java”.
- Otherwise, use the latest Java LTS version you, your team, and your application can take.
- Popularity trend: MySQL is #1, Postgres #2, and MongoDB is #3. MySQL and MongoDB surged over the last three months in job ad mentions, with MySQL leading Postgres now 2:1 and MongoDB reaching 70% of Postgres’ numbers.
- On your current project, keep your existing database unless that database is absolutely, irrevocably, really not working out for you.
- If you need to switch databases or are on a new project:
- If you know that you’ll need the NoSQL features and/or scalability, and you can’t get this with MySQL, then use MongoDB.
- Otherwise, use MySQL.
- Popularity trend: Spring Boot remains the framework to beat and still grows in most categories. Despite a long decline, Jakarta EE leads Quarkus in all categories but questions at Stack Overflow, where Quarkus hits its all-time high. Quarkus also placed number three in job ad mentions after DropWizard’s collapse, while Micronaut is number four.
- On your current project, keep your existing back-end framework unless that framework is absolutely, really not working out for you.
- If you need to switch back-end frameworks or are on a new project:
- Use Quarkus if you need the smallest possible, fastest-starting Java application now.
- Otherwise, use Spring Boot.
- Popularity trend: React is #1, Angular #2, and Vue #3. React leads Angular 1.4:1 in job ad mentions and pulls away from Angular in developer popularity. Vue holds steady in all categories at about half of Angular’s level but catches up in job ad mentions and (more slowly) in students at Udemy.
- If you already use React, Angular, or Vue in your project, then keep using them. Otherwise, evaluate a migration. In many (most?) cases, such migration doesn’t make business sense.
- If you start a new project or migrate, then start with React first, Angular otherwise, and finally Vue.
Mobile App Frameworks
- Popularity trend: React Native has 50% more apps on iOS but only leads Flutter in job ad mentions 1.5:1 after a steep decline in the last five months. Among developers, Flutter leads React Native 2:1 and pulls away (except for Google searches, where both slightly lost). Xamarin and JavaFX have generally declined for years.
- Don’t build two separate applications with Apple’s and Google’s first-party frameworks. Use a cross-platform framework instead.
- If you already use Flutter or React Native in your project, then keep using them. Otherwise, evaluate migration. In many (most?) cases, such a migration doesn’t make business sense.
- If you start a new project or migrate and have used React before, then start with React Native first and use Flutter otherwise.
- If you start a new project or migrate and have not used React, then begin with Flutter first and use React Native otherwise.
The next issue will arrive on Wednesday, January 3, 2023. It will have the Q1/2023 version of the Technology Index! Subscribe to my newsletter on Substack for free to receive the next issue automatically!
Karsten Silz is the author of this newsletter. He is a full-stack Java developer (Spring Boot, Angular, Flutter) with 23 years of Java experience. Karsten has worked in Europe and the US and is also a contractor, author, and speaker. He got a Master’s degree in Computer Science at the Dresden University of Technology (Germany) in 1996.
Karsten co-founded a software start-up in the US in 2004. He led product development for 13 years and left after the company was sold successfully. Karsten then co-founded the UK SaaS start-up “Your Home in Good Hands” as CTO in 2020.
Karsten has this newsletter, a developer website, and a contractor site. He’s on LinkedIn, Twitter, Xing, and GitHub. Karsten is also a Java editor at InfoQ.