How to Build Java Applications Today: May 24, 2021
Tags: java, bpf
Published: 2021-05-24 22:30:36

## TL;DR
Microsoft’s 2 reasons for its own JDK, Visual Studio Code gets better at Java, Spring Boot 2.5 & many more Spring releases, Google I/O, and Google Docs is too much for HTML.

***

## README
This is **issue 37** of my weekly newsletter, “How To Build Java Applications Today”. I read all the Java news, so **you** don’t have to! And I try not to bore you!

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

***

## Quote of the Week
*Education is what survives when what has been learned has been forgotten.‌*
If [B. F. Skinner](http://www.quotationspage.com/quote/904.html), [US psychologist (1904 - 1990)](https://en.wikipedia.org/wiki/B._F._Skinner), is right, then I’m barely educated about the code I wrote six months ago.

***

## Stand-Up
This week’s issue is dominated by Microsoft, Spring, and Google: Microsoft talked about their Java distribution and Java in Visual Studio Code, Spring released a plethora of projects, and Google’s developer conference IO was last week. 

I gave my first talk at a [Japanese Java conference last Sunday](https://fortee.jp/jjug-ccc-2021-spring/timetable). It’s been the most relaxed talk I ever gave: I pre-recorded the talk two weeks ago. 😁 So I was just there to answer questions after my talk video played. I got two questions. Given that I had the last talk of the day, that was an ok number. My talk page [is here](https://betterprojectsfaster.com/learn/talks-jjug-spring-2021-how-to-build-front-ends/).

***

## Code Review
### Issue 36 from May 17, 2021
In the “Tools” section I wrote how “Stack Overflow Switches to System Fonts”. I forgot to mention this: Now that both Stack Overflow and GitHub use systems fonts in their web applications, we can ask for the same in **our** web application. Ditch Arial!
 
***

## Bookmarks
### Java
#### Microsoft’s Reasons For Their Own JDK: Backports & Trust
In [issue 31](https://bpfnl.substack.com/p/how-to-build-java-applications-today-894), section “Microsoft Announces OpenJDK Distribution”, I reported that Microsoft released its own AdoptOpenJDK distribution. In a recent [developer show](https://youtu.be/MVkkDu5uz-I), Microsoft made its reasons clear:
- Microsoft can backport enhancements from later Java versions ([time-coded YouTube clip](https://youtu.be/MVkkDu5uz-I?t=449)) into Java 11. An example is this [OpenJDK issue](https://bugs.openjdk.java.net/browse/JDK-8251319) that’s not in the main OpenJDK 11 branch. But it **is** included in Microsoft’s OpenJDK 11 distribution.
- Microsoft can review all the source code and components of OpenJDK and produce binaries they can trust ([time-coded YouTube clip](https://youtu.be/MVkkDu5uz-I?t=591)). This prevents so-called supply chain attacks where an attacker uses somebody else’s software to spread malware. Last year, we saw an example of that: The United States government and 200 organizations worldwide were the targets of a [cyberattack that used the SolarWinds software](https://betterprojectsfaster.com/blog/weekly-links-2021-01-11#jetbrains-an-update-on-solarwindshttpsblogjetbrainscomblog20210107an-update-on-solarwinds) as its unknowing host.

Anything else that caught my eye?
- Microsoft highlighted their membership in [Eclipse Adoptium](https://projects.eclipse.org/projects/adoptium), the project formerly known as [AdoptOpenJDK](https://adoptopenjdk.net). RedHat, IBM (see [issue 32](https://bpfnl.substack.com/p/how-to-build-java-applications-today-126), section “IBM Joins Eclipse Adoptium To Publish OpenJ9 Binaries”), Microsoft and Alibaba Cloud as Eclipse Adoptium members bolster Adoptium’s status as the leading OpenJDK distribution.
- Microsoft demonstrated how [`jlink`](https://www.baeldung.com/jlink) can reduce the JDK size down to 25 MB in a Docker image. To Microsoft, this eliminates the need for a JRE. To me, GraalVM native images still seem like a better deployment mechanism down the line.

[YouTube video](https://youtu.be/MVkkDu5uz-I)

***

### Tools
#### Visual Studio Code Gets Better at Java
Visual Studio is Microsoft’s IDE. Well, there are actually three IDEs called “Visual Studio” - and they all are different:
- [“Visual Studio for Windows”](https://visualstudio.microsoft.com/vs/) is the good ol’ “Visual Basic and C# in Windows IDE” that most people think of when they hear “Visual Studio”. There’s a free version, but we [have to pay for use in an enterprise](https://visualstudio.microsoft.com/vs/compare/).
- Next up is “[Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/)”. As the name suggests, it doesn’t run on Windows. It [doesn’t do traditional Windows UI development or game development](https://visualstudio.microsoft.com/vs/mac/#vs_mac_table), either. It was called “[Xamarin Studio](https://en.wikipedia.org/wiki/Xamarin#Xamarin_Studio)” until Microsoft [bought Xamarin](https://www.wired.com/2016/02/microsoft-expands-empire-beyond-windows-xamarin-buy/).
- Last but not least is “Visual Studio Code”. That’s on open-source IDE that runs on Windows, Mac, and Linux. For a cross-platform application built with [TypeScript](https://en.wikipedia.org/wiki/TypeScript) and the [Electron framework - Chromium and Node](https://en.wikipedia.org/wiki/Electron_(software_framework)), it’s quite snappy. There are much worse Electron apps (Slack, I’m looking at you!). [Anders “Turbo Pascal, Delphi, C#, .NET, and TypeScript” Hejlsberg](https://en.wikipedia.org/wiki/Anders_Hejlsberg) leads this project.

Visual Studio Code claimed [14 million users last February](https://www.zdnet.com/article/visual-studio-code-how-microsofts-any-os-any-programming-language-any-software-plan-is-paying-off), up from 9 million in January 2020. How much is 14 million? The number of Java developers is estimated at 8 million, give or take (see section “Java developers” [here](https://www.daxx.com/blog/development-trends/number-software-developers-world)).

I think Microsoft clearly struck a nerve with Visual Studio Code. Now can we use it for Java development? Sure, we can. And it’s just gotten a whole lot better there: We can see that in the second part of the [Microsoft developer show from the previous article](https://youtu.be/MVkkDu5uz-I). Here are the new features (all links are time-coded YouTube links):
- We can pick our JDK in a new [configuration screen](https://youtu.be/MVkkDu5uz-I?t=1709).
- The new [welcome screen](https://youtu.be/MVkkDu5uz-I?t=1735) lets us create projects with Maven, Spring Boot, Quarkus, and MicroProfile.
- The new [Java Project view](https://youtu.be/MVkkDu5uz-I?t=1826) is modeled after Eclipse.
- The [type hierarchy](https://youtu.be/MVkkDu5uz-I?t=1871) view shows base classed and derived ones.
- We can [move classes to a new package with drag’n drop](https://youtu.be/MVkkDu5uz-I?t=1940).
- We can run targets directly in the [Maven view](https://youtu.be/MVkkDu5uz-I?t=2028).
- The [test explorer](https://www.youtube.com/watch?v=MVkkDu5uz-I&t=2061s) shows our tests.
- The [Spring Boot integration](https://youtu.be/MVkkDu5uz-I?t=2133) shows variable values inline during debugging.
- Microsoft’s cloud service Azure has its [own dashboard now](https://youtu.be/MVkkDu5uz-I?t=2278).
- Spring Cloud has a [new view](https://www.youtube.com/watch?v=MVkkDu5uz-I&t=2391s).

We IntelliJ or Eclipse users don’t see anything here that’s missing in our IDEs. But VS Code is free, leaner & meaner than our bloated IDEs, and (pure speculation on my part) used by more developers than either the JetBrains IDEs or Eclipse. IntelliJ, do you hear that sound? That’s Visual Studio Code, coming after you!

The video also demonstrated three general Azure features.
- [Insights](https://youtu.be/MVkkDu5uz-I?t=2465) are monitoring capabilities, similar to what [New Relic offers](https://newrelic.com). Even the host said so! The video drilled down into memory usage and individual database query.
- [DevOps Starter](https://youtu.be/MVkkDu5uz-I?t=2580) created a GitHub repository, GitHub action for continuous build with Gradle, deployed to Azure, and ran functional tests with Selenium at the end.
- A special shoutout went to Gradle: [It built in 33 seconds](https://youtu.be/MVkkDu5uz-I?t=2898) what took Maven multiple minutes. Moments like this make it worthwhile being in the minority of Gradle users (Snyk [gave 64% Maven market share in early 2020](https://snyk.io/blog/jvm-ecosystem-report-2020/), vs. Gradle’s 25%).

One last bit: The video of the presenter froze several times during the show (see [here](https://youtu.be/MVkkDu5uz-I?t=2379) and [here](https://youtu.be/MVkkDu5uz-I?t=2497)). It’s somewhat reassuring for us mere mortals that Microsoft can’t even give all its developer-facing staff proper Internet access.

[Microsoft developer show](https://youtu.be/MVkkDu5uz-I)

***

### Releases
#### Spring Boot 2.5, 2.4.6 & 2.3.11
Has it been six months already? It must because Spring Boot [just dropped another major release](https://spring.io/blog/2021/05/20/spring-boot-2-5-is-now-ga). It’s the last one before Spring Boot 3.0. At least I think it’ll be called “3.0”, going along with Spring 6.0 (see [issue 35](https://bpfnl.substack.com/p/how-to-build-java-applications-today-faf), section “Spring 6 With Java Modules?”).

It seems like all developers at Spring are busy with Spring 6 and support for GraalVM native compilation (see [issue 27](https://bpfnl.substack.com/p/how-to-build-java-applications-today-4b3), section “The Empire Strikes Back: Spring Native Beta Announced”). Because this **sounds** like the smallest Spring Boot release ever: Support for Java 16 and Gradle 7, enhanced Docker image building, and a new mechanism for Datasource initialization. You know they’re scraping the bottom of the barrel when an “updated look-and-feel and dark mode for the documentation” makes it into the primary “What’s new” section. 

The [2.5 release notes](https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.5-Release-Notes#user-content-new-and-noteworthy) don’t reveal much more: All embedded web containers now support HTTP/2 over TCP, Actuator supports new metrics, and we can use Jetty 10 as the embedded web server (which requires Java 11).

Alongside Spring Boot 2.5, we get [releases 2.4.6](https://spring.io/blog/2021/05/20/spring-boot-2-4-6-available-now) ([84 bug fixes, documentation improvements, and dependency upgrades](https://github.com/spring-projects/spring-boot/releases/tag/v2.4.6)) and [2.3.11](https://spring.io/blog/2021/05/20/spring-boot-2-3-11-available-now) ([52 changes](https://github.com/spring-projects/spring-boot/releases/tag/v2.3.11.RELEASE)).

[2.5 release announcement](https://spring.io/blog/2021/05/20/spring-boot-2-5-is-now-ga), [2.5 release notes](https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.5-Release-Notes), [2.4.6 release announcement](https://spring.io/blog/2021/05/20/spring-boot-2-4-6-available-now), [2.3.11 release announcement](https://spring.io/blog/2021/05/20/spring-boot-2-3-11-available-now)

***

#### Spring Security 5.5

If we deal with authentication or authorization in Spring, then we’re probably using Spring Security. Release 5.5 updates the OAuth Client, the OAUth Server, and the SAML Service Provider. The full build works with Java 11, and we get some more configuration updates.

[Release announcement](https://spring.io/blog/2021/05/18/spring-security-5-5-goes-ga), [release notes](https://docs.spring.io/spring-security/site/docs/5.5.0/reference/html5/#new)

***

#### Spring Integration 5.5

Spring Integration implements well-known [Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/). Release 5.5 supports [Spring Native](https://github.com/spring-projects-experimental/spring-native). It adds  the [File Aggregator component](https://docs.spring.io/spring-integration/docs/5.5.0/reference/html/file.html#file-aggregator) and has a host of other changes, as detailed by the [release notes](https://docs.spring.io/spring-integration/docs/5.5.0/reference/html/whats-new.html#whats-new). 

As you can tell quite quickly, I’ve never worked with Spring Integration and barely have an idea what it’s all about. 😅

[Release notes](https://docs.spring.io/spring-integration/docs/5.5.0/reference/html/whats-new.html), [release announcement](https://spring.io/blog/2021/05/19/spring-integration-5-5-goes-ga)

***

#### Spring Data 2021.0.1 & 2020.0.9 
These two maintenance releases seem to consist mainly of dependency updates, each with their own changelog. There’s a ton of them - 15 for 2021.0.1 and 16 for 2020.0.9. The changelog links are [in the announcement](https://spring.io/blog/2021/05/14/spring-data-2021-0-1-and-2020-0-9-released).

[Release announcement](https://spring.io/blog/2021/05/14/spring-data-2021-0-1-and-2020-0-9-released)

***

#### Spring Batch 4.3.3 & 4.2.7

These are pure maintenance releases. 4.3.3 has [11 changes](https://github.com/spring-projects/spring-batch/releases/tag/4.3.3), 4.2.7 [has 10](https://github.com/spring-projects/spring-batch/releases/tag/4.2.7.RELEASE).

Fun fact: I wanted to use Spring Batch in my current Spring Boot project. But it didn’t fully work with Spring Data JPA, so I couldn’t. Here’s the lesson, kids: Not all “Spring things” work together as seamlessly as you’d expect!

[Release announcement](https://spring.io/blog/2021/05/19/spring-batch-4-2-7-and-4-3-3-are-out)

***

### Over the Fence
#### Google I/O
Google’s developer conference skipped last year. But [it’s back this year](https://events.google.com/io/?lng=en) with the usual stuff.
- There’s a [new Android release](https://www.theverge.com/e/22203818): Version 12 looks bigger and rounder and more colorful and uses more animations. We may get that next year on existing phones or new phones (I’m still waiting for Android 11 from last September to grace my Nokia 5.3). And who knows what the vendor skins do with this new look.
- There’s a bunch of AI demos that you find either “creepy” (old farts in my age group) or “cool” (generation TikTok), [here](https://www.theverge.com/2021/5/18/22442328/google-io-2021-ai-language-model-lamda-pluto) and [here](https://www.theverge.com/2021/5/18/22442336/google-project-starline-3d-video-chat-platform) and [here](https://www.theverge.com/2021/5/18/22442466/google-photos-cinematic-moments-animated-android-ios-machine-learning).
- Google Maps will [show more information](https://www.theverge.com/2021/5/18/22442451/google-maps-live-view-update-features-ai-ar). And Google Docs, sorry, Google Workspace [integrates chats and calls and wants to embed everything](https://www.theverge.com/e/22204267), just like [Microsoft Fluid wanted to](https://www.theverge.com/2020/5/19/21260005/microsoft-office-fluid-web-document-features-build) last year.
- Android has [3 billion active devices](https://www.theverge.com/2021/5/18/22440813/android-devices-active-number-smartphones-google-2021). Apple only has [1 billion active iPhones and 1.65 billion active devices in total](https://www.theverge.com/2021/1/27/22253162/iphone-users-total-number-billion-apple-tim-cook-q1-2021), but that’s good enough for [nearly twice the app revenue](https://www.businessofapps.com/data/app-revenues/). 

[Google I/O keynote in 16 minutes](https://youtu.be/_xLgXIhebxA), [The Verge article](https://www.theverge.com/2021/5/18/22435419/google-io-2021-event-recap-biggest-announcements-pixel-android-12-wear-os-workspace), [The Vergecast podcast episode](https://overcast.fm/+QN1pyum1o)

***

#### Google Docs: Too Much For HTML!
Google also announced at Google I/O that Google Docs [won’t use HTML for its user interface anymore](https://www.theverge.com/2021/5/18/22440226/google-workspace-smart-canvas-features-docs-updates). Instead, it will draw text and images as points, lines and shapes directly on the [browser canvas](https://en.wikipedia.org/wiki/Canvas_element). That’s similar to how a video game engine paints heroes and monsters on a TV screen. 

Why now? Because Google wants to “make every single part of its Workspace suite of apps interconnected. You’ll be able to start a Meet video chat directly within Docs or share your Doc directly into a Meet call with a button in the doc.” And the developers at Google, among the best web developers in the world, can’t do that with HTML. So they fall back to the layer below HTML and paint the pixels themselves. 

So what does that mean for us Java developers?

Nothing, really. Yes, browsers can do a lot. But they can’t do everything. But our business applications work fine in HTML - they do **much** less than Google Docs. 

[The Verge article](https://www.theverge.com/2021/5/18/22440226/google-workspace-smart-canvas-features-docs-updates)

***

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