Tag: Java
How does Poor Man’s Load Balancer work?
- Natan Ferreira
- 0
- 31
Understanding the concept of Poor Man’s Load Balancer is an interesting and educational approach, especially for grasping the fundamentals of horizontal scalability using containers and load balancing. Horizontal scalability allows multiple container instances, and requests will be distributed by the Load Balancer. This model is widely used in high-demand environments. Benefits: Problems and Solutions: How…
Read MoreHow to run tasks in parallel with timeout in Java?
- Natan Ferreira
- 0
- 59
The use of Threads is essential to improving the performance and responsiveness of modern applications. With threads, it is possible to execute multiple tasks simultaneously, maximizing processor resources. They allow intensive operations, such as calculations or accessing external resources (e.g., databases, APIs), to be performed in parallel without blocking the main execution. Imagine the following…
Read MoreHow to create a Docker Image using maven?
- Natan Ferreira
- 0
- 89
Creating Docker images using Maven is essential to integrate the containerization process directly into the application’s build and deployment pipeline, offering significant benefits for developers and DevOps teams. Let’s see how to create a Docker image with Maven in Spring. This post is a continuation of the previous one; if you have any questions, feel…
Read MoreHow to build application image with Dockerfile?
- Natan Ferreira
- 0
- 105
Since this is a Java application, I need to use an image that can run a Java application. We need the Dockerfile and to use the OpenJDK base image. This Dockerfile is a recipe for building a Docker image that runs a Java application. Each instruction in the Dockerfile has a specific purpose. Let’s go…
Read MoreHow to handle exceptions in Spring?
- Natan Ferreira
- 0
- 86
Exception handling in APIs is essential to ensure clear and efficient communication between the server and client, preventing unexpected interruptions and enhancing the user experience. By properly handling exceptions, the API can return user-friendly and informative error messages, making it easier to identify and resolve issues. Additionally, this practice improves the application’s security and robustness,…
Read MoreHow do Spring IoC and Dependency Injection work?
- Natan Ferreira
- 0
- 82
Before discussing how Inversion of Control (IoC) and Dependency Injection (DI) work in Spring, it’s essential to understand what each of them means. If you have any questions, check out this post where I cover these two very important concepts. Spring has a container that manages Beans. Beans are objects managed by the Spring container…
Read MoreHow to use Rest Controllers in Spring?
- Natan Ferreira
- 0
- 87
When creating a REST API in Spring, it is necessary to use some annotations, as this allows us to create the endpoints. All of this is necessary because we need to follow the “Richardson Maturity Model” to maintain a REST API with a good level of maturity. If you want to learn more about the…
Read MoreWhat is Richardson Maturity Model?
- Natan Ferreira
- 0
- 93
It is a model (developed by Leonard Richardson) to improve API maturity. To achieve the glory of REST, the API must have maturity levels. There are 4 levels, and next we will see how each of them works. Level 0: The Swamp of POX This level defines that the use of the HTTP protocol is…
Read MoreWhat are Specifications in Spring Data Jpa?
- Natan Ferreira
- 0
- 123
Specifications allows the creation of dynamic queries programmatically using the provided filters in a flexible way. “JPA 2 introduces a criteria API that you can use to build queries programmatically. By writing a criteria, you define the where clause of a query for a domain class. Taking another step back, these criteria can be regarded as…
Read MoreHow to perform database schema versioning with Flyway and Spring?
- Natan Ferreira
- 0
- 57
Flyway is a tool used for database migration control. Migrations are executed automatically, and we also have a history of database modifications. Flyway supports many databases, but in this example, we will use MySQL. Requirements Project With this site, you can create your Spring project: https://start.spring.io To establish a connection with the database, we need…
Read More