Tag: springboot

  • 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

    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?

    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 send emails in Spring Boot?

    How to send emails in Spring Boot?

    To send emails using the Spring Boot Email Starter in a Spring Boot application, you can do the following: STEP 1: Add the Spring Boot Email Starter dependency to your project: STEP 2: Configure the connection to the email server in your application.properties file: STEP 3 Inject the JavaMailSender bean into your service and use…

  • How to implement Reactive Programming in Spring Boot?

    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…