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

@Component is a Spring annotation that is used to indicate that a class is a component. Components are objects that make up the structure of an application and are responsible for performing specific tasks. They are typically used to represent services, controllers, repositories, and other types of objects that are used to implement business logic…

Read More @Component Annotation in Spring

This tutorial covers three distinct methods for reading application properties in a Spring Boot application. These methods include: Using the Environment object. Using the @ConfigurationProperties annotation. Using the @Value annotation. I made a simple Spring Boot Web App to show you how to read application properties. You can use the tutorial Create a Simple Web…

Read More Spring Boot: Reading Application Properties

In this blog post, I will share the Spring annotations used to map HTTP requests to specific handler methods. These annotations include @PostMapping, @GetMapping, @PutMapping, and @DeleteMapping. While most Spring Boot applications use the @RequestMapping annotation, which I will also cover in this post, I’ll begin with the newer shortcut annotations that have been available…

Read More Spring Annotations @PostMapping, @GetMapping, @PutMapping and @DeleteMapping

In this Spring Security tutorial, you will learn how to enable and use the Method Level Security with a @Secured annotation. @Secured is a Spring Security annotation used to specify that a method should be executed only if the authenticated user has the required roles or authorities. When you use this annotation, you can specify…

Read More Spring Security @Secured: Method-Level Protection

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

This tutorial will teach you how to start your Spring Boot application on a random port number. Starting an application on a random port number is very helpful when you need to start multiple instances of the same Spring Boot application and then balance HTTP requests between the running instances. If you want to learn…

Read More Start Spring Boot App on a Random Port Number

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

In this tutorial, you will learn what @Scope annotation is and how to use it in Spring. @Scope is a Spring annotation used to specify a bean’s lifecycle. It can be used to define the lifecycle of a bean as a singleton, prototype, request, session, or global session. If you are interested to learn about other…

Read More @Scope Annotation in Spring