Migrate Docker container

Migrate Docker container

Docker is an open-source containerization platform that uses OS-level virtualization. It allows developers to package applications in an isolated environment called a container. There are various use-cases for containers: a database server, a web application server, etc. The basic principles of working with Docker containers are well-known to the majority of developers, but sooner or later a developer needs to migrate Docker container and this tutorial explains how to make this process simple.

Generate QR codes (Java)

Generate QR codes (Java)

A QR code (Quick Response code) is a type of a barcode invented in 1994 by the Japanese automotive company Denso Wave. In this article, we’ll get a basic information about QR codes in general and will learn how to generate QR codes in a Java application.

Hibernate logging

Hibernate logging

Working with object-relation mapping (ORM) tools like Hibernate lets developers operate mostly with object-oriented entities rather than relational tables, SQL, etc. Sounds quite attractive, but only from the first look. When the domain becomes more complex, sooner or later you’ll need to investigate the exact SQL queries being executed. So, let’s figure out how to enable various types of Hibernate logging.

N+1 select: JOIN FETCH (Hibernate)

N+1 select: JOIN FETCH (Hibernate)

Using object-relational mapping tools like Hibernate can significantly simplify and speed up the development process. For a developer, it’s easier to operate with object entities rather than switching to relational tables every time he needs to access a database. Nevertheless, it has its disadvantages. The main disadvantage is a high chance to ruin the performance if used without a good understanding of how it works under the hood. This tutorial covers the common problem called “N+1 select” and describes one of the solutions – JOIN FETCH.

Asynchronous methods using @Async annotation (Spring)

Asynchronous methods using @Async annotation (Spring)

Let’s imagine that you need to call a time-consuming service method from a controller and its result can be postponed. For example, it can import a huge number of records to a database and you can’t force the client to wait minutes/hours for a response. In such a case, it makes sense to make such a method asynchronous, i.e. a separate thread will be created to process the task, but the controller will immediately return to the user. Spring can easily help to configure asynchronous methods using @Async annotation.

Stateless OAuth2 Google authentication (JWT)

Stateless OAuth2 Google authentication (JWT)

Stateful authentication stores authentication sessions in some internal storage (in-memory, database, Redis, etc.) and returns a session identifier to a user.
In this tutorial, we’re going to cover stateless OAuth2 Google authentication when after a successful authentication a user receives an independent token (JWT in 99% of cases) with all required information in it. Both types of authentication have their own advantages and disadvantages. Stateless authentication is widely used for SPA applications and mobile clients.

JSON Web Token (JWT) and Java

JSON Web Token (JWT) and Java

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed.

One of the mostly used use-cases for JWT is authorization. A client authenticates and a server returns a generated token in response. The client stores the token and sends it with every further request.

How to create a Chrome extension

How to create a Chrome extension

A browser extension is a small software module for customizing a web-browser. Browsers usually provide a store with both free and paid extensions. In case of a Chrome Browser, they can be found in Chrome Web Store. The variety of existing extension covers almost everything. If it doesn’t fit all your needs, you’re free to create a Chrome extension yourself.

Reduce Java boilerplate (Lombok)

Reduce Java boilerplate (Lombok)

Have you ever had a feeling that a significant amount of code you write is redundant? It’s not a secret that Java can be quite verbose and often you just follow a contract of this programming language. Luckily, you’re not the only one who worries about it. As a result, a great solution to deal with it appeared to reduce Java boilerplate – Lombok.