RSSAmplifier

Blog

Wim Deblauwe

Recent content on Wim Deblauwe

wimdeblauwe.comRSS feed ↗133 posts

Latest posts

Writing a Thymeleaf component library - part 3

In part 1 we created a Thymeleaf component library that can be used in a Spring Boot application. Part 2 showed how to create an actual component with custom attributes and a passthrough of any attribute. In part 3 we will add support for slots, which allows to add arbitrary content inside a component.

Writing a Thymeleaf component library - part 2

In part 1 we created a Thymeleaf component library that can be used in a Spring Boot application. There is a sample application that uses the library, and there is full live reload support for changing the CSS and JS files in the library. We will create an actual component in the library and use it in the sample application.

Writing a Thymeleaf component library

This blog series will explain how to write a component library for Thymeleaf. The goal is to create a library that can be used in any Spring Boot application that uses Thymeleaf as the view technology. Users of the library should be able to use the components to quickly build a user interface without having to write a lot of HTML and CSS themselves.

Testing OAuth2 client login with mock-oauth2-server

If you use Spring Boot with Thymeleaf, you might be using an external OAuth2 provider like Keycloak or Okta to authenticate your users. In this blog post, I will show you how to test your OAuth2 client login with mock-oauth2-server .

Migrating away from Thymeleaf Layout Dialect

This blog post explains what the Thymeleaf Layout Dialect is, why you might want to stop using it, and how to migrate to a pure Thymeleaf solution using th:replace .

How I document production-ready Spring Boot applications

This blog post explains how I like to document a Spring Boot application I am writing. It is the third and last post in my series on writing production-ready Spring Boot applications. See How I write production-ready Spring Boot applications and How I test production-ready Spring Boot applications for the other posts in the series.

How I test production-ready Spring Boot applications

My previous blog post How I write production-ready Spring Boot applications explained how I like to write and structure my production code in Spring Boot applications. This blog post will further explain how I write tests for the code.

How I write production-ready Spring Boot applications

This blog post will explain how I currently write Spring Boot applications. I have been writing Java for over 25 years, and most of that involved Spring and its ecosystem. I will talk about how I architect my app, package structure, naming conventions, etc.

Combine Testcontainers and Spring Boot with multiple containers

Testcontainers is a great technology to run Docker containers of dependencies like a database or a messaging middleware like ActiveMq or Kafka. It might not immediately be obvious how to combine JUnit, Testcontainers and Spring Boot when you have multiple containers that your application needs. This blog post aims to provide some guidance on how to combine them.

Thymeleaf and TailwindCSS 4.0 updates

Last week Tailwind CSS v4.0 was released. This, unfortunately, broke the ttcli tool to generate a Spring Boot with Thymeleaf project when you selected Tailwind CSS.

Problems I no longer have by using Server-side rendering

I really like to use Spring Boot, Thymeleaf and htmx for a productive web application stack. However, most of my day-to-day work involves writing REST API backends (Well, JSON Data APIs really ) for Angular or React frontends. During that work, I sometimes can’t help but think “We would not have this issue we are discussing now if we had used server-side rendering instead of a JavaScript Single…

Redirect attributes with Spring MVC and htmx

A common implementation pattern with Spring MVC is showing a notification message after a redirect has happened. For example, you edit a product in a page and after saving the product you are redirected back to the list of products. At the top, you show a message "Product xyz updated". If the user manually refreshes the page, the message should disappear. To implement this, you can use redirect…

Technical presentations with Slidev

I recently started using Slidev for creating presentations. It is a tool to create a Powerpoint/Keynote/Google Slides like presentation, but using Markdown instead. In this blog post, I will explain the basics and share some of my favorite tips and tricks.

Using React components in a Spring Boot Thymeleaf project

This blog post will show you how to create your own React components in a Spring Boot with Thymeleaf project. The setup will use Vite to be able to write the React components in TypeScript and have live reload of the components so you can easily edit them and use them in your Thymeleaf templates. In the end, we will also see how we can use an existing React library in our application.

Authoring Web Components in a Spring Boot Thymeleaf project

This blog post will show you how to create your own Web Components in a Spring Boot with Thymeleaf project. The setup will use Vite to be able to write the Web Components in TypeScript and have live reload of the components so you can easily edit them and use them in your Thymeleaf templates.

Spring Integration using JSON serialization

In my previous blog post Transactional Outbox pattern with Spring Boot , I compared Spring Integration with Spring Modulith to implement the microservices outbox pattern. I mentioned that a drawback of Spring Integration is the fact that Java serialization is used so the data in the database is not readable with standard database tooling.

Transactional Outbox pattern with Spring Boot

If you are building a microservice architecture, or you just need to send emails from your monolith, you should look into the Transactional Outbox pattern to ensure reliable communication between services. This blog post shows a few ways how you can implement this using Spring Boot.

Rapid application prototyping with Bootify

Starting a new application can be a daunting task. How will you structure your code? How can you get started quickly? There are a few tools such as JHipster that help you setup your project. One such alternative that I recently looked at is Bootify .

Htmx global error handler

The htmx-spring-boot library 3.2.0 has just been released and now supports using HtmxResponse as a return type for error handlers. This blog post shows how you can use this.

Book launch: Modern frontends with htmx

🎉 Thrilled to announce the official release of my new book 'Modern frontends with htmx'! Discover how to master htmx with SpringBoot and Thymeleaf for rich, interactive web applications.

Ttcli release 1.0.0

I am happy to announce version 1.0.0 of ttcli . Ttcli is a command line tool to generate a Spring Boot with Thymeleaf project with support for live reloading.

Taming Thymeleaf update for Thymeleaf 3.1.2

Thymeleaf 3.1.2 was released recently and is inluded in Spring Boot 3.0.10 and 3.1.3 . For security reasons , it is no longer allowed for a Thymeleaf template to directly access org.springframework.web.servlet.support.ServletUriComponentsBuilder . This was used in my Taming Thymeleaf book to build a generic fragment that can be used for pagination controls. If you still use it, you get this…

Taming Thymeleaf update for Spring Boot 3

My book Taming Thymeleaf has just been updated on leanpub for Spring Boot 3. This blog post will walk you through the most important changes if you want to upgrade to Spring Boot 3 from Spring Boot 2 if you used the previous version of the book.

Toasts notifications in Thymeleaf with Shoelace and htmx - part 2

Yesterday, I shared how to combine Thymeleaf, Shoelace and htmx to show toast notifications in your web application. This worked pretty well and only needed a little JavaScript, but we can even further reduce the JavaScript used further and make them even more useful as the same time!

Toasts notifications in Thymeleaf with Shoelace and htmx

I recently played around with Shoelace , a library of web components. The nice thing about web components is that they are framework agnostic, so we can use them with Thymeleaf as well. This blog post will show how to use the Alert Toast component to show a confirmation or an error to the user. See also part 2 for a similar demo where the HTML of the notifications is generated in Thymeleaf instead…

Using Google login with Spring Boot 3 and Thymeleaf

Building a complete user management system yourself is quite some work. However, you can very easily allow users to use social login with Google for example and avoid having to do all that work yourself. This blog post will show how to quickly setup a Spring Boot with Thymeleaf project and secure it using Google login.

Release 1.0.0 and 2.0.0 of htmx-spring-boot-thymeleaf

I realized I have not written about the official releases I did for htmx-spring-boot-thymeleaf on this blog, so time to right this wrong now.

The error-handling-spring-boot-starter library vs Spring 6 ProblemDetail

I created the error-handling-spring-boot-starter library for Spring Boot because I was unhappy with the default response that Spring Boot 2 provides out-of-the-box. With Spring Boot 3, there is now support for ProblemDetail and we can have a look on how that changes things.

Started my YouTube channel

I started my YouTube channel this week. It was quite something to come to this result, speaking to a camera is quite scary at first, but I think I got a nice result in the end 🙂

Htmx authentication error handling

Using htmx is a great way to make your Spring Boot with Thymeleaf web application dynamic without page refreshes. Since there are no page refreshes, but transparent AJAX calls going on, it is important to put in error handling code to ensure a good user experience in case something goes wrong. This blog post shows how to do this.

Thymeleaf live reload with Spring Boot and Tailwind CSS

This is the 3rd and final part of my series on live reloading with Thymeleaf and Spring Boot, this time focusing on Tailwind CSS .

Thymeleaf live reload with Spring Boot DevTools

In my blog post of yesterday, I explained how to use Thymeleaf live reload with npm scripts . Quickly after announcing the blog post on Twitter, Oliver Drotbohm asked me why I didn’t just use Spring Boot DevTools instead. A valid question and one I will address in this follow-up post.

Thymeleaf live reload with npm scripts

UPDATE: I created a follow-up blog Thymeleaf live reload with Spring Boot DevTools that shows a way to have Live Reload with a little less setup work, but some important drawbacks as well in my opionion. Be sure to read both blog posts to get an informed opinion about which path to take. If you want to add Tailwind CSS to your project, go to Thymeleaf live reload with Spring Boot and Tailwind CSS…

Thymeleaf and htmx with out of band swaps

The htmx JavaScript library has a very neat feature called Out of Band Swaps . This blog post shows how to use this with Thymeleaf .

Error handling with Spring WebFlux

My error-handling-spring-boot-starter library had its first release almost 2 years ago. The first reported issue came soon after with a request to support Spring WebFlux. As I don’t have any Spring WebFlux projects myself, it was pretty low on my priority list. Especially as it did not seem trivial to add support. Luckily, about a month ago Fabio Marini opened a PR with all the building blocks I…

Bootstrap Toggle clone with Tailwind CSS and Alpine

I migrated a project from Bootstrap 4 with the Sleek dashboard template to Tailwind CSS as Bootstrap 4 stopped having bugfixes on 2021-07-01, and there is no version for Bootstrap 5. Anyways, I like Tailwind CSS a lot more to work with :) One of the components that the project used is Bootstrap Toggle , which makes a simple checkbox look a lot better. As the project kicked out Bootstrap, I needed…

Spring Boot request parameters validation

I released a new version 2.1.0 of the Error Handling Spring Boot Starter last week. It supports nice error messages for validation of request parameters now. This blog post shows some more detail on how you can do validation of request parameters.

Taming Thymeleaf 2.0 release

My book Taming Thymeleaf has been updated for Java 17, Spring Boot 2.6 and Tailwind CSS 3.0. This update is free for all Leanpub readers.

Using Server-Sent Events with Thymeleaf and HTMX

This blog post uses htmx 1.6. In htmx 1.7, server-sent events support has been moved to an extension . The example code on GitHub has been updated to work with htmx 1.7. See commit b46b15b for the (small) changes that are needed. It is possible to push information from a Spring Boot backend to the UI using either Websockets or Server-Sent Events. This blog post will show how to use Thymeleaf with…

Using Spring Boot ObjectMapper with hibernate-types

The hibernate-types library has extra types that are not found in Hibernate by default. One of the most interesting aspects of the library is the support for JSON types. Unfortunately, by default, the library will not pick up any Jackson configuration or custom serializers defined in your Spring Boot project. This blog post will show how to configure things so the JSON related configuration of…

TodoMVC with Thymeleaf and HTMX

In TodoMVC with Spring Boot and Thymeleaf , we implemented a TodoMVC clone using Spring MVC and Thymeleaf. In such a setup, each action triggers a page refresh. While this works just fine, you might want to give a more Single Page Application (SPA) spice to the experience and avoid page refreshes. This blog post will show how to use HTMX to accomplish this.

TodoMVC with Spring Boot and Thymeleaf (Part 3)

In Part 2 , we implemented completion and deletion of todo items. In this last part of the 3-part series, we’ll finish the implementation of our TodoMVC clone.

TodoMVC with Spring Boot and Thymeleaf (Part 2)

In Part 1 , we implemented TodoMVC using Spring Boot and Thymeleaf. The application already allows to add todo items and show them. We will continue in this part with completing items and deleting them.

TodoMVC with Spring Boot and Thymeleaf (Part 1)

The TodoMVC project has implementations of a simple todo list application for many different frontend frameworks. The goal is that a Single Page Application is implemented in a varity of technologies to be able to compare them. I wanted to stretch the concept a bit and create a Spring Boot backend with Thymeleaf server-side rendered HTML page just to see how that could work and how it would affect…

Thymeleaf iteration and fragments

Iteration in Thymeleaf templates is done using th:each . But combining it with fragments can yield some surprising results. This blog post shows an overview of what can happen and common pitfalls to watch out for.

Using Java 16 records with Thymeleaf

Since Java 16, we can use records. This blog post shows how Thymeleaf supports this.

Form handling with Thymeleaf

This post explains in detail how you should implement a HTML form with Thymeleaf and Spring Boot.

Error Handling Spring Boot Starter release 1.6.0

There is a new version 1.6.0 of the Error Handling Spring Boot Starter . A lot of new things have been added since I lasted blogged about version 1.2.0 of this library , so it is time for a round-up to show the new goodies.

Equals and hashcode implementation considerations

I always struggled with how to implement equals and hashcode, until I learned about the difference between entities and value objects.

Using HTML select options with Thymeleaf

This blog post will show the best way to implement a HTML <select/> to allow the user to select between one of several options.