How to Build Java Applications Today: May 10, 2021
Tags: java, bpf
Published: 2021-05-10 21:50:02

---
canonical_url: https://bpfnl.substack.com/p/how-to-build-java-applications-today-faf
---

TLDR
How to upgrade to Java 17, Spring 6 with Java Modules, Kotlin 1.5, JHipster Micronaut blueprint 1.0.0, and Bootstrap 5.0.

***

## README
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.

If you like my newsletter, then [subscribe to it on Substack](https://bpfnl.substack.com)!

***

## 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](https://www.goodreads.com/quotes/6803946-everything-around-you-that-you-call-life-was-made-up).

***

## Stand-Up
For the first time, I pre-recorded a conference talk this week. It’s the [JJUG CCC 2021 one](https://betterprojectsfaster.com/learn/talks-jjug-spring-2021-how-to-build-front-ends/#web-applications). 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! 

***

## Bookmarks
### Java
#### 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](https://bpfnl.substack.com/p/how-to-build-java-applications-today-4b3), “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](https://www.infoworld.com/article/3606833/jdk-17-the-new-features-in-java-17.html).

As usual on InfoQ, you can either view the video or read the transcript. The talk has a [companion repo on GitHub](https://github.com/johanjanssen/JavaUpgrades) with even more helpful information.

[InfoQ talk](https://www.infoq.com/presentations/upgrade-java16-java17)

***

### 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](https://youtu.be/Um9djPTtPe0?t=2791)). In other words: GraalVM support through Spring Native (see [issue 27](https://bpfnl.substack.com/p/how-to-build-java-applications-today-4b3), section “The Empire Strikes Back: Spring Native Beta Announced”). 

Surprisingly, [Juergen “Spring” Hoeller](https://spring.io/team/jhoeller) 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](https://www.infoworld.com/article/3543253/what-is-jpms-introducing-the-java-platform-module-system.html) 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](https://developer.okta.com/blog/2020/07/27/spring-boot-using-java-modules#modularize-the-persistence-library)”.

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](https://betterprojectsfaster.com/blog/weekly-links-2020-11-23/#jakarta-ee-9httpswwwinfoqcomnews202011jakarta-one-conference-2020).

[Issue comment](https://github.com/spring-projects/spring-framework/issues/26884#issuecomment-830225030)

***

### Releases
#### Kotlin 1.5
In [issue 30](https://bpfnl.substack.com/p/how-to-build-java-applications-today-b67), 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)
- Compiler changes
- Faster builds

Kotlin 1.5 is here now. Anything that I didn’t mention before? Yes: [Inline classes](https://kotlinlang.org/docs/inline-classes.html). 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](https://kotlinlang.org/docs/compatibility-guide-15.html).

[Announcement](https://blog.jetbrains.com/kotlin/2021/05/kotlin-1-5-0-released)

***

#### 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](https://betterprojectsfaster.com/learn/#tutorial-jhipster) in 2019. 
- And I reported the [recent 7.0 release for InfoQ](https://www.infoq.com/news/2021/04/jhipster-java-app-generator/).

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](https://micronaut.io) 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](https://github.com/jhipster/generator-jhipster-micronaut/blob/main/README.md).

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!

[Announcement & tutorial](https://micronaut.io/2021/04/19/jhipster-micronaut-blueprint-1-0-release)

***

#### Bootstrap 5.0
Bootstrap is the most popular CSS framework. What does “CSS framework” mean?
- Its famous [“grids & columns” layout](https://getbootstrap.com/docs/5.0/layout/grid/) makes writing responsive web applications easier.
- It also has components, such as [forms](https://getbootstrap.com/docs/5.0/forms/overview/), [cards](https://getbootstrap.com/docs/5.0/components/card/), and [navbars](https://getbootstrap.com/docs/5.0/components/navbar/).
- And Bootstrap has utilities for [foreground colors](https://getbootstrap.com/docs/5.0/utilities/colors/), [background colors](https://getbootstrap.com/docs/5.0/utilities/background/), [text](https://getbootstrap.com/docs/5.0/utilities/text/), and more.

We got version 5.0 more than three years after [4.0 landed](https://blog.getbootstrap.com/2018/01/18/bootstrap-4/). So - what’s new?
- Form controls are now [entirely custom](https://blog.getbootstrap.com/2021/05/05/bootstrap-5#checks-and-radios), and the form layout [is simpler](https://blog.getbootstrap.com/2021/05/05/bootstrap-5#simplified-layout). 
- We can now write `width: 50%` instead of `col-6` in a grid.
- They dropped support for Internet Explorer 10 & 11 and other old browsers. Finally!
- And the [logo](https://blog.getbootstrap.com/assets/img/2020/06/v5-new-logo.png) is new!

So we definitely need to study the [migration guide](https://getbootstrap.com/docs/5.0/migration) if we want to use Bootstrap 5. And work on release 5.1 is [already underway](https://github.com/twbs/bootstrap/projects/31).

[Announcement](https://blog.getbootstrap.com/2021/05/05/bootstrap-5)

***

## About
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](https://yourhomeingoodhands.co.uk/)" as CTO in 2020.

Karsten has [this newsletter](https://bpfnl.substack.com/), a [developer website](https://betterprojectsfaster.com/), and a [contractor site](https://ksilz.com/). He's on [LinkedIn](https://www.linkedin.com/in/ksilz/), [Twitter](https://twitter.com/karsilz), and [GitHub](https://github.com/ksilz).