In this first part, I will cover how the Cassandra data model is laid out in brief and perform basic operations using CQLSH. For this tutorial series, I am assuming that readers would be able to install Cassandra by themselves on their respective machines depending on the operating system.
In this article, we’ll look at how we can implement the strategy design pattern in Java 8. First, we’ll give an overview of the pattern, and explain how it’s been traditionally implemented in older versions of Java. Next, we’ll try out the pattern again, only this time with Java 8 lambdas, reducing the verbosity of our code.
In this article, we will be looking at a WeakHashMap from the java.util package. We will see how that construct is useful when implementing a cache. The WeakHashMap is a hashtable-based implementation of the Map interface, with keys that are of a WeakReference type. An entry in a WeakHashMap will automatically be removed when its key is no longer in ordinary use, meaning that there is no single Reference that point to that key.
In this article, we’ll take a look at the ConcurrentModificationException class. First, we’ll give an explanation how it works, and then prove it by using a test for triggering it. Finally, we’ll try out some workarounds by using practical examples.
This quick Hibernate tutorial will take you through an example of one-to-many mapping using JPA annotations – an alternative to the XML descriptor approach. In simple terms, one-to-many mapping means that one row in a table is mapped to multiple rows in another table.
In this article, we’ll see how the groupingBy collector works using various examples. To understand the material covered in this article, a basic knowledge of Java 8 features is needed. You can have a look at intro to Java 8 Streams and the guide to Java 8’s Collectors.
In this tutorial, we will demonstrate the use of the Apache POI and JExcel APIs for working with Excel spreadsheets. Both libraries can be used to dynamically read, write and modify the content of an Excel spreadsheet and provide an effective way of integrating Microsoft Excel into a Java Application.
In this article, we’ll explore how we can control HTTP caching with Spring Security. We’ll demonstrate its default behavior, and also explain the reasoning behind it. We’ll then look at ways to change this behavior, either partially or completely.
Spring 4.3. introduced some very cool method-level composed annotations to smooth out the handling @RequestMapping in typical Spring MVC projects. In this article, we will learn how to use them in an efficient way.
In this article, we’ll focus on the PriorityBlockingQueue class and go over some practical examples. Starting with the assumption that we already know what a Queue is, we will first demonstrate how elements in the PriorityBlockingQueue are ordered by priority. Following this, we will demonstrate how this type of queue can be used to block a thread.
In this tutorial, we’ll show how to use the Google Guava’s Preconditions class. The Preconditions class provides a list of static methods for checking that a method or a constructor is invoked with valid parameter values. If a precondition fails, a tailored exception is thrown.
Maps are naturally one of the most widely style of Java collection. And, importantly, HashMap is not a thread-safe implementation, while Hashtable does provide thread-safety by synchronizing operations. Even though Hashtable is thread safe, it is not very efficient. Another fully synchronized Map, Collections.synchronizedMap, does not exhibit great efficiency either. If we want thread-safety with high throughput under high concurrency, these implementations aren’t the way to go.
In a running Java program, all code is executed in threads and within a thread everything happens sequentially, one instruction after another. When Java (or rather the JVM) launches, it creates one thread for the main method to be executed in. From there, new threads can be created to execute code in parallel to the main one. The most basic way to do that is to use the Thread class.
In this post, I will discuss Spring Boot integration for MariaDB. MariaDB started off as an offshoot of MySQL due to concerns of Oracle’s acquisition of MySQL. Led by the original developers of MySQL, MariaDB has become one of the fastest growing open source databases.
This is part 6 of the tutorial series for building a web application using Spring Boot. In this post we look at adding a DAO Authentication provider for Spring Security. As the Spring Data JPA dependency is included in our Maven POM, Hibernate gets pulled in and configured with sensible default properties via Spring Boot. This post builds upon 5 previous posts. If you’re not familiar with all the content around Spring,
Spring Data project provides integration for most of the popular databases around. I have already written few posts to configure Spring Boot to use Oracle, MySQL, and PostgreSQL – all RDBMS widely used in the enterprise. Recently we’ve seen a rise in popularity of NoSQL databases. MongoDB has rapidly gained popularity in the enterprise and the Spring community. In this post, I’ll discuss how to use MongoDB with a Spring Boot application.
This article shows you how to use cURL command to POST JSON data to a Spring REST API. To test above REST API, you can use the cURL command to post a JSON data like this...
In this tutorial, we’re going to explore this powerful tool for describing, building, and managing Java software projects using a central piece of information — the Project Object Model (POM) — that is written in XML.
In the first article, "Getting Started with R Using Java," we started with installing R and installing the rJava package. We discussed initializing the JVM, setting the classpath, creating a Java object, and calling a Java method. In this tutorial, we shall discuss the rJava package to use Java Strings and the Swing Java API from R. This tutorial has the following sections:
In this article, we will look at Ordering class from the Guava library. Ordering class implements a Comparator interface and gives us a useful fluent API for creating and chaining comparators. Java 8 has a method Comparator.comparing() that provides a similar functionality so Ordering will be particularly useful in projects that were not migrated to Java 8 yet and this is why we will be using anonymous classes instead of Lambda Expressions.