Rolling Back Migrations with Flyway
1. Introduction In this short tutorial, we'll explore a couple of ways to rollback a migration with Flyway. 2. Simulate Rollback with a Migration In this section, we'll rollback our database using a...
View ArticleSSH Connection With Java
1. Introduction SSH, also known as Secure Shell or Secure Socket Shell, is a network protocol that allows one computer to securely connect to another computer over an unsecured network. In this...
View ArticleDifference Between when() and doXxx() Methods in Mockito
1. Introduction Mockito is a popular Java mocking framework. With it, it's simple to create mock objects, configure mock behavior, capture method arguments, and verify interactions with mocks. Now,...
View ArticleGetting Network Information from Docker
1. Overview One of the main features of Docker is creating and isolating networks. In this tutorial, we'll see how to extract information about networks and the containers they hold. 2. Networking in...
View ArticleDAO vs Repository Patterns
1. Overview Often, the implementations of repository and DAO are considered interchangeable, especially in data-centric apps. This creates confusion about their differences. In this article, we'll...
View ArticleKeycloak User Self-Registration
1. Overview We can use Keycloak as a third-party authorization server to manage users of our web or mobile applications. While it's possible for an administrator to add users, Keycloak also has the...
View ArticleJava Weekly, Issue 350
1. Spring and Java >> How to encrypt and decrypt JSON properties with JPA [vladmihalcea.com] Revisit the JPA lifecycle events: encrypting and decrypting JSON properties with JPA >> Creating...
View ArticleHow to Implement Hibernate in an AWS Lambda Function in Java
1. Overview AWS Lambda allows us to create lightweight applications that can be deployed and scaled easily. Though we can use frameworks like Spring Cloud Function, for performance reasons, we usually...
View ArticlePassing Command Line Arguments in Gradle
1. Overview Sometimes, we want to execute various programs from Gradle that require input parameters. In this quick tutorial, we’re going to see how to pass command-line arguments from Gradle. 2. Types...
View ArticleChecking if a Class Exists in Java
1. Overview Checking for the existence of a class could be useful when determining which implementation of an interface to use. This technique is commonly used during older JDBC setups. In this...
View ArticleArrays.asList vs new ArrayList(Arrays.asList())
1. Overview In this short tutorial, we'll take a look at the differences between Arrays.asList(array) and ArrayList(Arrays.asList(array)). 2. Arrays.asList Let's start with the Arrays.asList method....
View ArticleSocial Login with Spring Security in a Jersey Application
1. Overview Security is a first-class citizen in the Spring ecosystem. Therefore, it's not surprising that OAuth2 can work with Spring Web MVC with almost no configuration. However, a native Spring...
View ArticleDifferences in @Valid and @Validated Annotations in Spring
1. Overview In this quick tutorial, we'll focus on the differences between @Valid and @Validated annotations in Spring. Validating users' input is a common functionality in most of our applications. In...
View ArticleJava Weekly, Issue 351
1. Spring and Java >> Java 15 is released! [openjdk.java.net] Java 15, a new Java version packed with new and exciting features, is released: Sealed classes, Pattern matching, Text blocks,...
View ArticleHow to Remove a Prefix From Strings in Groovy
1. Introduction In this quick tutorial, we'll learn how to remove the prefix from a string in Groovy. First, we'll look at what the String class offers for this purpose. After that, we'll move on to...
View ArticleSending Emails with Attachments in Java
1. Overview In this quick tutorial, we'll learn how to send emails with single and multiple attachments in Java using JavaMail API. 2. Project Setup In this article, we're creating a simple Maven...
View ArticleJSON Parameters with Spring MVC
1. Overview In this short tutorial, we're going to take a close look at how to work with JSON parameters in Spring MVC. First, we'll start with a little bit of background on JSON parameters. Then,...
View ArticleSpring Boot Without A Web Server
1. Introduction Spring Boot is a great framework for quickly creating new Java applications for a variety of use cases. One of the most popular uses is as a web server, using one of the many supported...
View ArticleGuide to the System Rules Library
1. Overview Sometimes when writing unit tests, we may need to test code that interacts directly with the System class. Typically in applications such as command-line tools which call System.exit...
View ArticleReducing JSON Data Size
1. Introduction Java applications often use JSON as a common format for sending and receiving data. Moreover, it's used as a serialization protocol for storing data. With smaller JSON data sizes, our...
View Article