Tag: springboot

  • How to write unit test cases for REST APIs in Spring Boot?

    How to write unit test cases for REST APIs in Spring Boot?

    One of the ways to write robust code is to write unit test cases. This way you make sure that the changes you make on a code doesn’t break any existing functionality. This helps in preventing bugs later. Spring Boot provides an easier way to write unit test cases for your REST APIs. Let’s see…

  • Documenting your REST API’s in Spring Boot

    Documenting your REST API’s in Spring Boot

    Let’s say you have created a bunch of REST APIs. And now your client wants to use these REST APIs. They want to call a few APIs and use the response. How do you share the information with them? How many REST APIs does your application have? What are they? What is a sample request…

  • How to implement authorization using JWT/OAuth2 in Spring Boot?

    There are two main aspects in Security: Authentication deals with whether the user who tries to access an application is a legitimate user. Authorization deals with whether the user has rights to read/modify a particular resource in the application. In this post let us look into authorization in Spring Boot. Let us consider an application…

  • How to connect to database from a REST API?

    How to connect to database from a REST API?

    Web applications store data in a database. Doing so , data is stored permanently somewhere so that you can process it later. Even if your application server goes down , you still have the data in your database. Spring makes it easy to connect to any database. You require very minimal code to do this.…

  • How to create a REST API in Spring Boot?

    How to create a REST API in Spring Boot?

    Let’s say you want to create an ecommerce store. And you want to expose REST APIs to the end users to do CRUD(Create, Read , Update and Delete) operations on your store items. You can do this with minimal effort in Spring Boot. Let’s create the REST APIs. Creating a REST API in Spring Boot…

  • How to implement CQRS design pattern in Spring Boot?

    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

    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 five 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?

    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.…