Tag: springboot
-
How to implement CQRS design pattern in Spring Boot?
Contents Problem: Let’s say you run a large scale ecommerce store. You have a large user base who query your system for products much more than they buy them. In other words , your system has more read requests than write requests. And so you would like to handle the high load of read requests…
-
Different ways to do versioning of REST APIs in Spring Boot
Most of our web apps communicate through HTTP / REST APIs. These APIs can evolve over time. And hence maintaining different versions of them can be helpful. For example , lets say you have been hitting a REST API which returns the different products available on an ecommerce store. The owners decide to launch a…
-
Different ways to call REST APIs in Spring Boot without additional libraries
In today’s world most modern web apps talk to each other through HTTP APIs. REST API is a popular standard for these HTTP APIs. So calling a REST API from your backend app is a critical functionality. Spring Boot provides multiple abstractions to do this in a simple way. Here are four different ways: Using…
-
How to implement Aspect Oriented Programming in Spring Boot?
In your web app , Often you need to implement certain logic which is common across different parts of your application. Like purely technical aspects like logging , security etc. You don’t want to repeat this logic in each part of the code. And you also don’t want to clutter your code by including logic…
-
How to query data in Spring Data through Example?
One of the frequent operations you perform on a database is retrieving data based on certain criteria. Let’s say you have a table containing developer details , their name , experience and their primary technology skill. And you want your app to be able to query this data. There are many ways to do this.…
-
How to implement Reactive Programming in Spring Boot?
Programming comes in different paradigms. For long , we did procedural programming using languages like C where the business logic was executed step by step in a procedural manner. Then came Object Oriented Programming where you modeled your business requirement into domain objects. It represented real world more closely and has been quite successful even…
-
How to implement Transactional Outbox design pattern in Spring Boot Microservices?
Let’s say you have created a microservice. One of the APIs in the microservice does two operations: How can you make sure both are transactional? In other words if database update fails don’t send the message to the other service and if message sending fails rollback the database update? In Spring you handle transactions using…
-
How to implement distributed tracing using Spring Cloud Sleuth in Spring Boot?
Microservices comes with many advantages. But there are disadvantages too. One of them is tracing the logs of your microservices. When there are so many microservices , user requests will span many of them and it will be difficult to trace the logs for a particular request when an issue occurs. To resolve this you…
-
How to do server side load balancing using Spring Cloud Gateway and Netflix Eureka?
In this post we saw how to do client side load balancing in Spring Boot Microservices. One disadvantage of client side load balancing is every microservice client need to implement this load balancing. This might not be a big deal given how simple the changes required are. Still there is some coupling on the client…