Author: Vijay SRJ
-
Java 21 – Record Patterns
Pattern Matching is a new area where Java has been introducing quite a few changes recently. It started with instanceof operator. Previously in Java , if you had to access an object whose instance type you didnt know prior, you had to use instanceof operator this way: You had to do a cast operation as…
-
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…
-
How to configure sensitive configuration details in your Angular app without being visible to the front end user?
Often in your angular app you need to configure sensitive data like credentials. You can store this in your code but then it will be visible to any one who loads your angular app in their browser. You can store it in a config file under assets directory , still it might be exposed to…
-
How to share data across multiple components for a single request in a Spring Boot application?
Let’s say that you make a REST API request to a spring boot web application. There is a security requirement that you need to log the user id across all the method calls in the application for this particular request. Something like this: So , if your application flow starts from a controller class and…
-
How to automatically delete rows from Dynamo DB through AWS Cloud formation template?
Let’s say you have built an app which uses AWS Dynamo DB as database. And you have a use case where you want to delete the rows in the table after a certain time , let’s say 1 hour. This can be done automatically! You just need to configure “Time To Live” settings while creating…
-
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…
-
The Real Benefits of Java Lambdas
Java 8 introduced the concept of Lambda expressions. They provide a concise way to represent functions as objects. A lambda expression is essentially an anonymous function that can be treated as an object and passed around as an argument to methods or stored in variables. Here is an example: In this example, the MathOperation interface…
-
Classes in Javascript vs Java
Nothing happens outside a class in Java. To create an object you need a class. Even to print a simple “Hello World” you need a class. That is not always the case with Javascript. You can create objects without using a class. Everything need not be encapsulated within a class! There are similarities between the…
-
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…