How to Build Java Applications Today: May 10, 2021
How to upgrade to Java 17, Spring 6 with Java Modules, Kotlin 1.5, JHipster Micronaut blueprint 1.0.0, and Bootstrap 5.0.
This is issue 35 of my weekly newsletter, “How To Build Java Applications Today”. I read all the Java newsletters, so you don’t have to! And I try to entertain you a bit while presenting Java news.
Quote of the Week
Everything around you that you call life was made up by people that were no smarter than you.
That was easy to say for Apple founder Steve Jobs.
For the first time, I pre-recorded a conference talk this week. It’s the JJUG CCC 2021 one. The video limit is 40 minutes, leaving ten minutes for questions during the conference.
I recorded the talk in one go last Sunday afternoon. I kept recording whenever I misspoke, just trying again. That’s how I ended up with a 51 minutes raw recording. 😅 Fortunately, it turned into 39 minutes and 40 seconds after editing!
How to upgrade to Java 17
This September, we’ll get the next Long-Term Support (LTS) version of Java: Java 17. So how do we actually upgrade our projects to Java 17? Especially when most of us are still on Java 8 (69%, according to JRebel - see issue 27, “JRebel 2021 Java Technology Report”)?
This talk helps with the upgrade. Here’s some of the advice:
Wait for your dependencies and build tools to support the new Java version.
If going from, say, Java 8 straight to Java 17 gives you trouble, then move in smaller steps (such as Java 8 to Java 9 and then to Java 11).
Java 11 removed JavaFX and fonts from the JDK.
Java 16 locked away some internals, so you need Lombok 1.18.20 for it (if you use Lombok).
It doesn’t look like Java 17 will remove much that bothers us.
As usual on InfoQ, you can either view the video or read the transcript. The talk has a companion repo on GitHub with even more helpful information.
Frameworks & Libraries
Spring 6 With Java Modules?
We don’t know much about Spring 6.0, the next major release due this fall. Except for that Spring Boot 3 and Spring 6 are “expected to provide first-class support for native application deployment”, as announced at the last Spring One conference (time-coded YouTube link). In other words: GraalVM support through Spring Native (see issue 27, section “The Empire Strikes Back: Spring Native Beta Announced”).
Surprisingly, Juergen “Spring” Hoeller revealed the “introduction of
module-info definitions across the codebase”. That’s for the Java Module System, I suppose. You know, the feature that finally shipped with Java 9 but failed to get widespread adoption. So will Spring 6 allow us to build applications with Java modules? That would be quite a surprise because “Spring (version 5) is not modularized yet”.
Juergen also confirmed the “JDK baseline upgrade”. So Spring 6 will require something newer than Java 8, the baseline for Spring 5.x. Java 11 is the safe bet here. Or maybe even 17?
Finally, Juergen also confirmed the usage of Jakarta EE 9 APIs with the renamed packages.
In issue 30, section “The Road to Kotlin 1.5”, I already looked at the upcoming Kotlin 1.5 release:
Support for records (Java 16) and sealed interface (Java 15)
Kotlin 1.5 is here now. Anything that I didn’t mention before? Yes: Inline classes. But don’t worry, they’re a pretty esoteric feature: They have a single property that the constructor initializes. And then that single value is “inlined into its usages”. Told you that they’re esoteric!
The announcement below has more details, videos, and a migration guide.
JHipster Micronaut Blueprint 1.0.0
I’m a sucker for JHipster, the open-source Java application generator:
I’m putting my second JHipster applications into production this May.
I wrote a tutorial for it in 2019.
And I reported the recent 7.0 release for InfoQ.
So what is JHipster? Let me quote my InfoQ article:
JHipster jump-starts new microservice and monolith applications by generating complete projects with CRUD screens, user management, administration, tests, Continuous Integration, and deployment. Initially only for Spring Boot, JHipster now also generates Micronaut, Quarkus, NodeJS, and .NET projects.
Micronaut is one of the many new Spring Boot competitors out there. And they just hit the 1.0 milestone for their JHipster integration. It’s a plugin, and JHipster calls plugins “blueprints”. Yeah, I don’t know why either.
Anyhow, that’s wonderful news for JHipster! But the integration currently has two drawbacks:
It’s still based on the old JHipster 6.x release.
It only supports a subset of the JHipster options, listed in the README.
So let’s hope that they’ll at least quickly move to JHipster 7.0. Micronaut 2.5 came only seven weeks after Micronaut 2.4, so there’s hope!
Bootstrap is the most popular CSS framework. What does “CSS framework” mean?
Its famous “grids & columns” layout makes writing responsive web applications easier.
We got version 5.0 more than three years after 4.0 landed. So - what’s new?
We can now write
width: 50%instead of
col-6in a grid.
They dropped support for Internet Explorer 10 & 11 and other old browsers. Finally!
And the logo is new!
Karsten Silz is the author of this newsletter. He is a full-stack web & mobile developer with 22 years of Java experience, author, speaker, and entrepreneur. Karsten got a Master’s degree in Computer Science at the Dresden University of Technology (Germany) in 1996.
Karsten co-founded a software product start-up in the US in 2004. He led product development for 13 years and left after the company was sold successfully. He co-founded the UK SaaS start-up “Your Home in Good Hands” as CTO in 2020.