-
Log Message Validation with JUnit 5
Introduction In your unittests it is important to check whether the code under test has been executed correctly. Sometimes, all you can check is log statements. In this guide, we will leverage the JUnit 5 Extension Model to intercept and verify logging. We will asume Logback is used in the application. Capture logging statements The first thing…
-
Elevate Your Web Content: Adding Image Support with Spring Boot, Thymeleaf, and CKEditor
Introduction In this guide, we will walk you through the process of integrating image support into your online text editor using a stack that includes Spring Boot, Thymeleaf, and CKEditor. Whether you’re building a wiki, a recipe site, or any application where visual content matters, this tutorial will help you take the next step in…
-
Testing databases with Testcontainers and Liquibase
Testcontainers make it easy to test your database integration by providing docker containers for many databases, which can be started from within your unittest. This is great, but it requires a bit of work to get started since the databases are empty. Liquibase is a tool to manage database schema changes. Combining the two is…
-
Send an email with Spring Boot and Thymeleaf
Using Spring Boot and Thymeleaf, it’s easy to send HTML emails to your users. This post will show the configuration and logic to send an email. We won’t go into details on how to setup the template, that’s for another time. Project setup Assuming you already use Spring Boot, we need to add two dependencies…
-
Spring Boot – Load users from database
This is the third article in a series on authentication with Spring Boot. In the first article we authenticated using social networks, and allowed any user to access our application. In the second article we used inMemoryAuthentication for users that used the login form. In essence, we hardcoded our users. This article is about adding…
-
Spring Boot login with a form
Previously I wrote about securing your application with social login. But not everybody has a social account. In this article we’re going to add formlogin to the application. Formlogin simply means that your users can log in with a username and password. We’re going to keep it as simple as possible, with in-memory authentication. Adding…
-
Spring Boot and Oauth2 with Thymeleaf
Spring has a good tutorial explaining how to authenticate with your application using one or more external authentication providers, like GitHub or Google. This tutorial uses a single page application with a Rest endpoint. For a personal project I didn’t want a single page application, I wanted to use Thymeleaf. During implementation I discovered a…
-
Apache HttpClient
For a hackaton I wanted to read some files from our BitBucket server. I knew the URLs of the files, but there were some complications. First, you need to be authenticated. According to the documentation, the preferred way of authentication is HTTP Basic Authentication when authenticating over SSL. We are using an SSL connection, but…
-
Linux: Spring Boot as a service on port 80
Well, that’s a mouth full. This blog shows how to run your Spring Boot application on port 80 when your linux server starts. We are going to use Ubuntu or Linux Mint for this, and we’re going to assume that Java is installed. Setup Spring Boot The first thing we need to do is tell…
-
Multiple Full-Screens in Java
Working with Java’s Full-Screen Exclusive Mode is a bit different than working with AWT, Swing or JavaFX. The tutorial describes how, and why, this works. The information, however, is a bit spread out. Also, it doesn’t mention how to work with multiple full screens at the same time. Not that it’s very different from working…