Convert Time to Milliseconds in Java 1. Overview In this quick tutorial, we’ll illustrate multiple ways of converting time into Unix-epoch milliseconds in Java. More specifically, we’ll use: Core Java’s java.util.Date and Calendar Java 8’s Date and Time API Joda-Time library 2. Core Java ==== 2.1. Using Date Firstly, let’s… Continue Reading java-time-milliseconds

Transactions with Spring and JPA 1. Overview This tutorial will discuss the right way to configure Spring Transactions, how to use the @Transactional annotation and common pitfalls. For a more in-depth discussion on the core persistence configuration, check out the Spring with JPA tutorial. Basically, there are two distinct ways… Continue Reading transaction-configuration-with-jpa-and-spring

Finding the Difference Between Two Strings in Java 1. Overview This quick tutorial will show how to find the difference between two strings using Java. For this tutorial, we’re going to use two existing Java libraries and compare their approaches to this problem. 2. The Problem Let’s consider the following… Continue Reading java-difference-between-two-strings

wait and notify() Methods in Java 1. Introduction In this article, we’ll look at one of the most fundamental mechanisms in Java – thread synchronization. We’ll first discuss some essential concurrency-related terms and methodologies. And we’ll develop a simple application – where we’ll deal with concurrency issues, with the goal… Continue Reading java-wait-notify

Registration with Spring Security – Password Encoding 1. Overview This article discusses a critical part of the registration process – password encoding – basically not storing the password in plaintext. There are a few encoding mechanism supported by Spring Security – and for the article we’ll use BCrypt, as it’s… Continue Reading spring-security-registration-password-encoding-bcrypt