Focus

Java

Articles, podcasts, talks, and more about Java.
Blog Post

Why not scatter @Transactional everywhere?

@Transactional — great when you know when not to use it. Use it consciously instead of sprinkling it everywhere!

Blog Post

Always up to date

JDK 23 already contains the second preview for the new Class-File API, which will probably be completed in JDK 24. Now it’s time to take a look at what this API is all about and how we can use it.

Blog Post

Spring Boot Actuator Endpoints

What does ‘production-ready’ actually mean?

Blog Post

Building Standardized AI Tools with the Model Context Protocol (MCP)

In this article, we’ll explore the integration of Large Language Models and systems built on top of them. The key concept in this space recently is the Model Context Protocol (MCP).

Blog Post

Use webjars-locator-lite with internal WebJars

Switching to the new webjars-locator-lite, e.g. by following the Spring Boot 3.4 Release Notes, may result in errors when loading your internal WebJars. This post explains why that is the case and what you can and should do to fix that.

Blog Post

Java and its annotations

Stories of code before and without annotations

Blog Post

Type-safe SQL queries in Java and Rust

In recent years, our industry has been in favour of strong typing and build-time verification to make certain classes of bugs impossible. How much influence has this trend had on how we can write SQL queries in Java? Let’s look at how typesafe SQL queries can be in Java, how this compares to what you can do in Rust, and consider the benefits and drawbacks of these different approaches.

Blog Post

Type-safe HTML templates in Java and Rust

The current fashion in our industry is to use static and strong typing wherever possible. How fashion-conscious is the Java community when it comes to HTML templating, though? Let’s have a look at what approaches at type-safe or build-time verified HTML templating are available in the Java ecosystem, how they compare to what’s available in Rust, and whether the benefits outweigh the costs.

Blog Post

Type-safe HTTP routing in Java and Rust

The Type-Safe Web Stack, Part 1

Blog Post

Automating Dependency Updates with Renovate

Regardless of whether we are working on an application or a library, we always have to deal with dependencies. We are dependent on the version of our programming language, on external or internal libraries, and on tools. In addition to the actual administrative tasks, it is also necessary to update these regularly. Even beyond performing the update itself, this means we need to learn when a new version exists. That’s why this article examines a bot-based solution that can help us with this exact issue.

Blog Post

Extending the OpenTelemetry Java Agent for Spring Auto-Instrumentation

OpenTelemetry is great. A few days ago, I was diving a bit more into the intrinsics of the OpenTelemetry standard and the Java auto-instrumentation in particular.

Blog Post

Rate Limiting with Spring Boot, Bucket4j, and Redis

Blog Post

Rate Limiting with Spring Boot

Let’s implement rate-limiting protection for your Spring Boot server without the need for any additional dependencies beyond those included in the Spring Boot Starter package.

Blog Post

Rooting Out Issues: JPA and Lombok Combination Problems Demystified

Ever encountered perplexing issues with JPA and Lombok’s @Data annotation when handling entities in Java? This blog post explores unexpected behaviors, especially with auto-generated IDs, in conjunction with equals and hashCode methods. Learn about identity and uncover how you can resolve these challenges forever.

Blog Post

Automated code maintenance with OpenRewrite

Part 1

Blog Post

JDK 21, the next long-term support release

The newest JDK release, version 21, appeared on September 19th. A number of developers view it as a long-term support release that will be supported for at least the next five years. As many applications will presumably be updated to version 21 from JDK 17, the last long-term support release, we would like to take this opportunity to examine the relevant changes from 17 to 21.

Blog Post

Containers for tests and local development with Spring Boot 3.1

Spring Boot 3.1.0, the most recent minor release of Spring Boot 3, appeared in May. In this article, we will be taking a look at how the new support for Testcontainers and Docker Compose can help us with tests and local development.

Blog Post

Testing in Spring Boot applications

Slice it up, please

Blog Post

Property-based Testing with “fast-check”

It isn’t exactly news that developers have to write not only code but also tests. Nevertheless, many find this to be burdensome and monotonous work. Plus, it is far from guaranteed that unit tests actually cover all the border and non-border cases. A modern approach is property-based testing, which consists of specifying an abstract condition that is then automatically checked by the test framework.

Blog Post

How to Encrypt a File on the JVM

You’ve got a secret password and some bytes you’d like to encrypt. JVM has all the tools you need to get it done.

Blog Post

Automated code maintenance with OpenRewrite (Part 2)

Blog Post

Automated code maintenance with OpenRewrite (Part 1)

With the large number of software development projects in most organisations, keeping these projects up to date with the latest security patches and framework updates can be quite a task. OpenRewrite is a library that provides an automated solution to this problem. Using recipes written in Java, it can perform large-scale source code refactoring during the build process, preserving as much of the original code as possible. In this blog post, I will explain how OpenRewrite works and how you can use it to refactor your code base.

Blog Post

Logging in Java

Logback, Log4j, SLF4J, and many more. Anyone working with automatic logging in Java will immediately come across an entire range of libraries that, at first glance, seem to do the same thing: issue log messages. So, in this article, we want to look at why there are so many libraries in Java and how they actually differ from each other upon closer inspection.

Blog Post

Querying DNS and LDAP Using JNDI

What Is JNDI Actually?

Blog Post

Processing JSON in Java

In contrast to many other programming languages, JDK for Java does not provide an out-of-the-box solution for the reading and writing of data in JavaScript Object Notation (JSON). So we have to find a suitable library for performing this task. In this article we therefore look at a selection of appropriate libraries.

Blog Post

Libraries for command-line applications

Command-line applications are admittedly not the most common due to the start time of the JVM. Their development for internal applications can however be appropriate, depending on the level of knowledge of the team. And thanks to the native compiling with GraalVM, the start time is accelerated. Much of the work involved in a command-line application involves parsing and use of the provided arguments and options. We look at four possible libraries that can assist us.

Blog Post

A Comparison of Java HTTP Clients

Many Roads Lead to the Web

Blog Post

The Way of the Request

The Play Framework is a web application framework for Scala and Java inspired by Ruby on Rails. Although I like the official documentation, I always found it lacking in how requests runs through the framework. This article takes the reader on a journey tracing a request through the framework.

Blog Post

Using feature flags with FF4j, Togglz, and Unleash in Java

Feature flags are now a fixed feature of many projects. In this column we will consider which problems can be resolved with their use. In addition to the theory, we also look at the three Java libraries FF4j, Togglz, and Unleash, with which feature flags can be used in Java.

Blog Post

Progressive Enhancement with Hotwire

The definitive renaissance of server-side rendering?

Blog Post

Pragmatic RESTful HAL APIs

The Hypertext Application Language (abbr. HAL) is a media type extension to plain JSON/XML – with its introduction in 2012 – no longer a newcomer and used already in many projects with Hypermedia APIs. A good time then to say a few words of praise, also to show obstacles and what solutions we found in daily work with HAL APIs - for implementing clients as well as for the server side.

Blog Post

Cookie-based Spring Security Session

If you need authentication within your Spring Boot web application, the natural choice is to use Spring Security. It’s easy to use and, as long as you stick close to the defaults, it’s also quite easy to configure. But, by sticking to those defaults, you will automatically get a session that is persisted on the server-side. That’s a problem.

Blog Post

An Introduction to TypeScript

for Backend Development (and Java Developers)

Blog Post

What Could Possibly Go Wrong

What could possibly go wrong if you put Clojure 1.10 and Scala 2.13 on the same classpath? We’re about to find out.

Blog Post

Integrating Logback with JLine

Logback is a popular logging library for Java. JLine can be used to create nice shell-like applications. Combining both is not as hard as it looks.

Blog Post

Native Clojure with GraalVM

Blog Post

Spring-less testing

Spring is a great project, it helps a lot with common, usually mundane, tasks. But it’s not always unicorns and rainbows. Too much Spring in tests can cause a few issues like long execution time and fragility. Here, I’m showing how to avoid such pitfalls.

Blog Post

Web Scraping

This blog post provides examples how to implement web scraping using HtmlUnit, Selenium or jaunt and compares them.

Blog Post

Play 2.4 with Guice and MyBatis

Blog Post

Per request debugging with Log4j 2 filters

Customers quite regularly call on me to support them when an application is not behaving as expected. On a development machine there are a lot of ways and utilities to analyse the situation. But troubleshooting the erroneous application behaviour in production environments quite often limits your tool belt to a minimum.

Blog Post

Docker images for developers

Docker seems to be all the rage lately. There are docker talks at every conference, hosting Docker containers has become a hosting option with most if not all PaaS providers, and there is hardly a technology left that is not supposed to run better and more flexibly if you wrap it in a Docker container. Well, except maybe for enterprise-level DBMSs, but you can’t have them all. This post provides an example how Docker can be used at the start of the software lifecycle, during development.

Blog Post

Hystrix – to make your fuse blow just in time

Case Study

HILFE FÜR JUNGS (“Help for Boys”): Reliable software for mobile consultations