Search results for: Spring Security

In this Spring Boot Security tutorial, you will learn how to use Spring method-level security to secure RestController methods with @PreAuthorize annotation. If you are interested in video lessons, then I also show how to create user Roles and Authorities and how to use Spring Method Level Security annotations in my video course: RESTful Web…

Read More Spring Method-Level Security with @PreAuthorize

In this tutorial, I will guide you through setting up a Kafka Consumer in a Spring Boot application. You will learn how to configure the consumer properties, create a listener class using the @KafkaListener annotation, and how to process messages with the @KafkaHandler annotation. Let’s start with the configuration. Kafka Consumer Configuration in application.properties In…

Read More Creating Kafka Consumer in Spring Boot Microservice

In this tutorial, you will learn what is Spring Cloud Vault, how to install and run HashiCorp’s Vault using three different methods: from HashiCorp website, using Homebrew, or as Docker container. What is Spring Cloud Vault? How do we store secrets safe in a distributed system? Secrets are sensitive information that you don’t want to expose…

Read More Installing and Running HashiCorp’s Vault for Spring Cloud

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

In this tutorial you will learn how to enable and how to view Spring Cloud API Gateway Routes using Spring Boot Actuator. Developers use Actuator to enable API Gateway routes in order to keep track of the routes being used in their application. By exposing these routes through Actuator endpoints, developers can get valuable information…

Read More Viewing Spring Cloud API Gateway Routes with Spring Boot Actuator

Spring Boot Actuator is a useful feature that provides developers with a set of tools to monitor and manage their applications. However, some of the actuator endpoints are sensitive and can potentially expose sensitive information about your application. In this article, we’ll explore different ways to secure these endpoints to ensure your application is protected.…

Read More Securing Spring Boot Actuator Endpoints: Best Practices

In this tutorial, I will explain in detail how to secure sensitive Spring Boot Actuator Endpoints using Spring Boot version 3. This tutorial is intended for beginners who want to learn how to monitor and manage their Spring Boot applications using Actuator. Spring Boot Actuator is a sub-module of Spring Boot that provides production-ready features…

Read More How to Secure Spring Boot Actuator Endpoints with Basic Authentication

This tutorial will guide you on how to incorporate JUnit support into your Spring Boot application based on Maven. Spring Boot Starter Test Dependency To add JUnit and Mockito support to your Maven-based Spring Boot application, include the following dependencies in the <dependencies> section of your pom.xml file: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> By adding…

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