How to Build Java Applications Today: May 24, 2021
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!
Quote of the Week
Education is what survives when what has been learned has been forgotten.
If B. F. Skinner, US psychologist (1904 - 1990), 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. 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.
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, section “Microsoft Announces OpenJDK Distribution”, I reported that Microsoft released its own AdoptOpenJDK distribution. In a recent developer show, Microsoft made its reasons clear:
Microsoft can backport enhancements from later Java versions (time-coded YouTube clip) into Java 11. An example is this OpenJDK issue 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). 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 as its unknowing host.
Anything else that caught my eye?
Microsoft highlighted their membership in Eclipse Adoptium, the project formerly known as AdoptOpenJDK. RedHat, IBM (see issue 32, 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
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.
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” 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.
Next up is “Visual Studio for Mac”. As the name suggests, it doesn’t run on Windows. It doesn’t do traditional Windows UI development or game development, either. It was called “Xamarin Studio” until Microsoft bought Xamarin.
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 and the Electron framework - Chromium and Node, 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 leads this project.
Visual Studio Code claimed 14 million users last February, 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).
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. Here are the new features (all links are time-coded YouTube links):
We can pick our JDK in a new configuration screen.
The new welcome screen lets us create projects with Maven, Spring Boot, Quarkus, and MicroProfile.
The new Java Project view is modeled after Eclipse.
The type hierarchy view shows base classed and derived ones.
We can run targets directly in the Maven view.
The test explorer shows our tests.
The Spring Boot integration shows variable values inline during debugging.
Microsoft’s cloud service Azure has its own dashboard now.
Spring Cloud has a new view.
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 are monitoring capabilities, similar to what New Relic offers. Even the host said so! The video drilled down into memory usage and individual database query.
DevOps Starter 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 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, vs. Gradle’s 25%).
One last bit: The video of the presenter froze several times during the show (see here and here). It’s somewhat reassuring for us mere mortals that Microsoft can’t even give all its developer-facing staff proper Internet access.
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. 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, 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, 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 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 (84 bug fixes, documentation improvements, and dependency upgrades) and 2.3.11 (52 changes).
2.5 release announcement, 2.5 release notes, 2.4.6 release announcement, 2.3.11 release announcement
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, release notes
Spring Integration 5.5
Spring Integration implements well-known Enterprise Integration Patterns. Release 5.5 supports Spring Native. It adds the File Aggregator component and has a host of other changes, as detailed in the release notes.
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, release announcement
Spring Data 2021.0.1 & 2020.0.9
These two maintenance releases seem to consist mainly of dependency updates, each with its 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.
Spring Batch 4.3.3 & 4.2.7
These are pure maintenance releases. 4.3.3 has 11 changes, 4.2.7 has 10.
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!
Over the Fence
Google I/O
Google’s developer conference skipped last year. But it’s back this year with the usual stuff.
There’s a new Android release: 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 and here and here.
Google Maps will show more information. And Google Docs, sorry, Google Workspace integrates chats and calls and wants to embed everything, just like Microsoft Fluid wanted to last year.
Android has 3 billion active devices. Apple only has 1 billion active iPhones and 1.65 billion active devices in total, but that’s good enough for nearly twice the app revenue.
Google I/O keynote in 16 minutes, The Verge article, The Vergecast podcast episode
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. Instead, it will draw text and images as points, lines and shapes directly on the browser canvas. 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.
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” as CTO in 2020.
Karsten has this newsletter, a developer website, and a contractor site. He’s on LinkedIn, Twitter, and GitHub.