Java/Cloud: How to Quickly Create a Kubernetes-Ready REST Microservice

It is safe to say that the Microservice + Cloud combination is all the rage these days. Microservices are being developed more than ever, in turn increasing the number of application deployments. During the past decade, containerization and orchestration tools such as Docker and Kubernetes were developed, making the microservice pattern easy to adopt.

This article will teach you how to generate a completely functional microservice with an exposed REST API capable of interacting with a MySQL database and deploy it to your local Kubernetes cluster. The learnings here can be applied to almost any database type like Oracle, SQL Server, DB2, and so on.

Java14: Join Database Tables With Java 14’s New Record

Java14 Records in Joins

Did you know that you can join database tables into a Java Stream with Java 14's preview record feature? Read this short article and find out how it is done using the Speedment Stream ORM. We will start with how to set up your project.

You may also like: A First Look at Records in Java 14

Setup

Download Java 14. Go to the Speedment Initializer and download your project skeleton (including pom.xml). Modify the following lines in your pom.xml file.

Java/Spring: How to Generate an Entire Database CRUD REST API With Speedment

Generate an Entire Database CRUD REST API With Speedment
As each year passes, it is becoming nothing but obvious that the Spring Framework is one of the most widely-used web development frameworks for Java. With the next decade just around the corner, Spring's most popular module, Spring Boot, has just received a major update.

The new Spring Boot version "2.2.0" and the year "2020" are almost a perfect match. Thus, the Speedment team has now filled the gap by revamping the Spring Boot plugin.

If this is your first time hearing of Speedment, you're in for a treat, as we will be demonstrating how the Speedment Spring Boot plugin allows developers to effortlessly build Spring database applications with Speedment, an ORM with a powerful Stream-based query API, as its backbone.

Java: How to Create Lightweight Database Microservices

Build database microservices that are as light as a feather!

The number of cloud-based Java database applications grows by the minute. Many organizations deploy hundreds — if not thousands — of microservice instances. However, most applications carry an astounding amount of unnecessary overhead with respect to the runtime environment. This, in turn, makes the application slower and more expensive to run.

In this article, I will demonstrate how to write a database application that is 10 times smaller than normal(*). The storage requirement will be about 32 MB instead of the usual(*) ~300 MB taking both the application, third-party libraries, and the Java runtime into account. As a bonus, the required RAM to run the application will also be reduced by 25 percent.

Become a Master of Java Streams (Part 4): Database Streams

You can almost see the data flowing...

SQL has always been a declarative language whereas Java for a long time has been imperative. Java streams have changed the game. Code your way through this hands-on-lab article and learn how Java streams can be used to perform declarative queries to an RDBMS database, without writing a single line of SQL code. You will discover, there is a remarkable similarity between the verbs of Java streams and SQL commands.

Not quite what you're looking for? Take a look at Querying Databases Using Java Streams.

This article is the fourth out of five, complemented by a GitHub repository containing instructions and exercises to each unit.

Become a Master of Java Streams, Part 2: Intermediate Operations

Want to become a Java Streams Master?

Just like a magic wand, an Intermediate operation transforms a Stream into another Stream. These operations can be combined in endless ways to perform anything from simple to highly complex tasks in a readable and efficient manner.

This article is the second out of five, complemented by a GitHub repository, containing instructions and exercises to each unit.

Become a Master of Java Streams — Part 1: Creating Streams

Check out the article below to become a master of Java Streams!

Declarative code (e.g. functional composition with Streams) provides superior code metrics in many cases. Code your way through this hands-on-lab article series and mature into a better Java programmer by becoming a Master of Java Streams.

The whole idea with Streams is to represent a pipeline through which data will flow and the pipeline's functions operate on the data. This way, functional-style operations on Streams of elements can be expressed. This article is the first out of five where you will learn firsthand how to become a Master of Streams. We start with basic stream examples and progress with more complex tasks until you know how to connect standard Java Streams to databases in the Cloud.

Java: An Optional Implementation of Optional

The class java.util.Optional is implemented as a single immutable concrete class that internally handles two cases; one with an element and one without. Wouldn't it have been a better choice to let Optional be an interface and have two different implementations implement that interface instead? After all, that is what we generally are taught to do in an object-oriented language.

In this article, we will learn about some of the potential arguments for the current Optional implementation. We will also learn why Streams are implemented in a different way, enabling Streams to be obtained from files or even database tables.

Java: ChronicleMap Part 3, Fast Microservices

Standard Java Maps needs to be initialized upon startup. Learn how to leverage  ChronicleMaps in a way that is initializable from a file as well as reduces microservice startup time significantly and how to share Maps between JVMs.

The built-in Map implementations, such as HashMap and ConcurrentHashMap, are fast but they must be initialized with mappings before they can be used for looking up values. Also, they are limited in size by practical means such as heap and RAM size. Lastly, they are local to the JVM it runs in.

Java: Chronicle Bytes, Kicking the Tires

I recently contributed to the open-source project “Chronicle Decentred” which is a high-performance decentralized ledger based on blockchain technology. For our binary access, we relied on a library called “Chronicle Bytes” which caught my attention. In this article, I will share some of the learnings I made while using the Bytes library.

What Is Bytes?

Bytes is a library that provides functionality similar to Java’s built-in ByteBuffer but obviously with some extensions. Both provide a basic abstraction of a buffer storing bytes with additional features over working with raw arrays of bytes. They are also both a VIEW of underlying bytes and can be backed by a raw array of bytes but also native memory (off-heap) or perhaps even a file.

Java: How to Become More Productive With Hazelcast in Less Than 5 Minutes

What if you want to use a Hazelcast In-Memory Data Grid (IMDG) to speed up your database applications but you have hundreds of tables to handle? Manually coding all Java POJOs and serialization support would entail weeks of work, and when done, maintaining that domain model by hand would soon turn into a nightmare. Read this article and learn how to save time and do it in 5 minutes.

Now, there is a graceful way to manage these sorts of requirements. The Hazelcast Auto DB Integration Tool allows connection to an existing database, which can generate all these boilerplate classes automatically. We get true POJOs, serialization support, configuration, MapStore/MapLoad, ingest and more without having to write a single line of manual code. As a bonus, we get Java Stream support for Hazelcast distributed maps.