-
Continue reading →: Proxy vs. Facade Pattern in Java
The Proxy and Facade patterns are structural design patterns in object-oriented programming, and they serve different purposes: Proxy Pattern interface Image { void display(); } class RealImage implements Image { private String fileName; public RealImage(String fileName) { this.fileName = fileName; loadFromDisk(); } private void loadFromDisk() { System.out.println(„Loading “ + fileName);…
-
Continue reading →: AWS services categories by the amount of code
AWS services can be categorized by the amount of code required:
-
Continue reading →: Thread vs. Runnable in Java
Thread: Creating a Thread by Extending the Thread Class: class MyThread extends Thread { public void run() { System.out.println(„Thread is running.“); }}public class ThreadExample { public static void main(String[] args) { MyThread t1 = new MyThread(); // Creating an instance of MyThread t1.start(); // Starting the thread }} Runnable: Creating…
-
Continue reading →: Partitioning in PostgreSQL
Partitioning in PostgreSQL is a database optimization technique where large tables are divided into smaller, more manageable pieces called partitions. Each partition is a subset of the main table’s data, typically based on a specific criterion like range, list, or hash. For example, a sales table could be partitioned by…
-
Continue reading →: Like Queries in Spring Data JPA
In Spring Data JPA, you can define a method in your repository interface to find entities where a field’s value is similar to a specified value using the `LIKE` keyword. The method naming convention in Spring Data JPA is crucial, and you can leverage the `findBy` keyword along with the…
-
Continue reading →: Observer Pattern in Java
The Observer Pattern in Java is a design pattern where an object, called the subject, maintains a list of dependent objects, called observers, that are notified automatically of any changes to the subject. When the subject’s state changes, it updates all its observers without them needing to constantly check for…
-
Continue reading →: Pessimistic and optimistic locking
In the context of REST APIs, databases, and Spring Boot, pessimistic locking and optimistic locking are two ways to manage data updates. This ensures data consistency but can cause delays. Pessimistic Locking : Spring Boot allows the use of pessimistic locks through JPA’s @Lock annotation or by specifying lock options…
-
Continue reading →: Role-Based Access Control with Keycloak, Spring Boot, and OpenID Connect
Keycloak is an open-source identity and access management tool that simplifies authentication and authorization in applications. When you combine Keycloak with Spring Boot and OpenID Connect (OIDC), you can easily set up role-based access control (RBAC) to secure your application. To start, install and configure Keycloak, setting up a realm…
