sebastiandaschner news

friday, november 25, 2022

Hello and welcome to another newsletter!

I just came back from the JavaSummit IL conference in Tel Aviv, Israel, which was the first time that conference was organized. I think the organizers did a great job in putting together a single-day Java-focused conference, there were many attendees and a lot of interest, and I really enjoyed the time. In December I’ll give another talk on the controversial topic of logging at the Vienna JUG and that’ll be it for this year in terms of giving presentations.

On December 12th & 13th, I’ll be holding full-day online workshops on the topic of modern development and testing with Quarkus. If that sounds interesting to you or your colleagues, please join us.


What’s New


Java Records

If you’re using JDK 16 onward, you can make use of Java Records to for data transfer carriers, and streamline your code.

I’ve recorded two videos on this topic that show how what Java Records are good for and how to use them. The first one explains how Records work, how to define them, and how we can save a lot of code:

What You Need to Know About Java Records

The second video shows records in action in a Quarkus application, and that we can already use them in a few scenarios, showing JSON data transfer objects, Hibernate embeddable database mappings, and query result types:

How to Use Java Records With Quarkus


Sending Email Using the Gmail API and Java

Gmail offers a handy API integration if you want to send email from your applications. I’ve been using the Gmail API a few times in applications and also helper tools such as cronjobs that should send a notification via email.

I’ve created a video that shows how to programmatically send email in Java, how to configure your Gmail account for that, and how to create and use credentials. Especially the part how to create your own credentials and how to get started can be a bit bumpy, so I hope this helps.

Sending Email Using the Gmail API And Java


Capitalize English Titles With Java, Quarkus & GraalVM

I’m not a native speaker in English and yet I’ve been writing a lot over the last years, and I’m still struggling as how to capitalize English titles (in headlines, article titles, etc.). To make that easier, I’ve created a small tool that I use on the command line, powered by Java, Quarkus, Picocli, and GraalVM. The linguists among you might now say that there no simple way to capitalize without doing a proper Grammar analysis (and you’d be right), but for my purposes this solution is good enough™.

$> capitalize-title a river runs through the city
A River Runs Through the City
$> capitalize-title my cloud-native deployment
My Cloud-Native Deployment

The project runs on Quarkus and Picocli, and in order to speed up the time the command line takes, I’m using native executables built by GraalVM. While the JAR/JVM version takes a few hundred milliseconds to complete, the native executable runs pretty much instant. So you will notice a difference.

I found this a nice example where native builds really shine, since for enterprise applications it really depends whether you want to go native — and for multiple reasons my answer is usually no.

You can have a look at the full example on my blog: Capitalize English Titles With Java


Thanks a lot for reading and see you next time!


Did you like the content? You can subscribe to the newsletter for free: