In this tutorial, you will learn how to use the @PostAuthorize annotation to secure the return of the method’s return value in your Spring Boot Application. The @PostAuthorize annotation is evaluated after the business logic in a method is executed and if needed will prevent the method from returning a return value. There are other…
Read More @PostAuthorize Security Annotation Example
This tutorial will guide you on how to incorporate JUnit support into your Spring Boot application based on Maven. Introduction Brief Explanation of JUnit and Its Importance in Testing JUnit is a popular open-source testing framework for Java applications. It provides a set of tools and methods for writing and running automated tests, making it…
Read More JUnit Support in Spring Boot
In this article, you will learn how to perform user authentication with Amazon Cognito in a Spring Boot application. But before we dive into that, let’s first explore what Amazon Cognito is. According to what’s mentioned on the AWS official website: Amazon Cognito lets you add user sign-up, sign-in, and access control to your web…
Read More User Authentication with Amazon Cognito in Spring Boot Application
In this article, we will learn about Many-to-Many relationships in JPA and how to implement them in a Spring Boot application. Let’s get started! @ManytoMany annotation A many-to-many relationship occurs when multiple records in one table are associated with multiple records in another table. The @ManyToMany annotation is used to define a many-valued association with…
Read More Many-to-Many Relationship in Spring Boot Rest with JPA
Dependency Injection is a design pattern that allows the separation of concerns in an application by removing the hard-coded dependencies between objects. In Dependency Injection, the objects are provided with their dependencies instead of having to hard-code them. This makes the application more flexible, maintainable, and easier to test. Spring Framework provides several ways to…
Read More Field-based Dependency Injection in Spring
Spring Boot offers various methods and techniques for setting up your database. It can automatically create and initialize the database using the information in the data source. Spring Boot looks for SQL files in specific locations in your project’s classpath, such as “schema.sql” and “data.sql”. In this tutorial, you will learn how to configure your…
Read More Database Initialization with Spring Boot
In this tutorial, you will learn what the @Respository annotation is and how to use it in your Spring Boot applications. @Repository is a Spring annotation that indicates that the decorated class is a repository. A repository is a mechanism for encapsulating storage, retrieval, and search behaviour which emulates a collection of objects. How to…
Read More @Repository Annotation in Spring
Spring is a popular open-source Java-based framework for developing enterprise applications. It was first developed by Rod Johnson in 2003 and has since become one of the most widely used Java frameworks, with millions of downloads and numerous high-profile projects using it. Key Features Here are some key features of Spring Framework that make it…
Read More What is Spring Framework
This tutorial will teach you how to implement Role-based access control in the new Spring Authorization Server. You will learn how to add a user role to a JWT token issued by Spring Authorization Server and configure Spring Resource Server to secure access to the API endpoint based on a user role. 1. Create, Run…
Read More Role-based Access Control in Spring Authorization Server
This tutorial will teach you how to migrate from the depricated WebSecurityConfigurerAdapter towards the content-based security configuration. Spring Security allowed customizing HTTP security by extending a WebSecurityConfigurerAdapter class. This customization included user authorization, user authentication, etc. But in Spring Security 5.7.0-M2 the WebSecurityConfigurerAdapter is deprecated. This is because Spring Framework developers encourage users to move…
Read More Migrate from Deprecated WebSecurityConfigurerAdapter (Solved!)
In this article, we will cover the basics of Aspect-Oriented Programming (AOP). You will learn how to use AspectJ to provide different AOP advices to Spring Boot applications to support cross-cutting issues like logging, profiling, caching, and transaction management and finally we will do a practical implementation to record user operations using Spring Boot AOP.…
Read More A guide to Spring Boot AOP to Record User Operations
In this tutorial, you will learn how to create and configure the new Spring OAuth Authorization Server. Video Demonstration To demonstrate how to configure and use the new Spring Authorization Server, I have created a series of step-by-step video lessons. You can access these video lessons by enrolling in my video course called “OAuth 2.0…
Read More Spring Authorization Server Tutorial
Spring Web MVC – Overview for Beginners (Includes video tutorial) Configure JSP Support (Includes video tutorial) Configure Thymeleaf Support (Includes video tutorial) The Model Object (Includes video tutorial) The ModelMap Object (Includes video tutorial) The ModelAndView Object (Includes video tutorial) Reading URI Path Variables (Includes video tutorial) Reading URL Query String Parameters (Includes video tutorial) Read Form Data in Spring Web MVC…
Read More Spring Web MVC Tutorials
In this tutorial, we are going to see how to insert records into a DynamoDB table using an AWS Lambda function written using Spring Boot Java. We are also going to add an AWS API Gateway trigger to the Lambda function and see how it works. To follow this tutorial, make sure that you have…
Read More Writing into DynamoDB in a Spring Boot App using AWS Lambda
In the previous blog post, we have covered how to grant access to certain endpoints based on the Role configured through code. As we know, Keycloak is the Identity and Access Management solution that provides out-of-the-box authentication and authorization services. One of the services includes a Fine-Grained Authorization Service. Fine-Grained Authorization Service provides businesses with…
Read More Fine-grained Authorization Services in Keycloak with Spring Boot