Author: user
-
How to configure query parameters in Spring Controllers
In this post, we will discuss what query parameters are and how to configure them in a Spring controller using the @RequestParam annotation. We will also discuss how to set your query parameters as optional, how to configure multiple query parameters and more. Before we start, I highly recommend that you check out our introductory…
-
The Java Bean Validation Cheat Sheet
In our previous post, we discussed how to use Java bean validation (AKA JSR-303 or Jakarta Bean Validation) in your Spring Boot and Java applications. We also discussed in a separate post, how to use bean validation to validate REST API calls. However, we only introduced a very small subset of the constraints that are…
-
How to use Java Bean Validation in Spring Boot
Java bean validation, AKA JSR-303 is a Java standard which is used to perform validation on items inside a Java application. Validation is performed by applying “constraints” on data items. As long as the data satisfies these constraints, it will be considered valid. Such constraints can be a specific numerical value range, being null or…
-
Error handling in REST and Spring Boot
In our previous tutorials, we discussed how build a CRUD REST API in a Spring Boot environment. However, we have not yet discussed how to handle common errors that can occur, such as when the user tries to fetch a non-existing item. In this tutorial, we will discuss some solutions and strategies for handling errors…
-
Using PUT vs PATCH when building a REST API in Spring
In our previous post “how to create a CRUD REST API in Spring Boot”, we discussed how to create a basic REST interface in Spring boot using the different HTTP verb mapping annotations @GetMapping, @DeleteMapping, @PutMapping and @PostMapping. These mappings correspond to the HTTP methods GET, DELETE, PUT and POST respectively. However, we have not…
-
How to validate REST calls in Spring Boot
In our previous post, we discussed how to get started with REST in Spring boot, and how to get a REST endpoint up and running. However, callers of the endpoint were able to send any data to our server, and this data would be accepted and saved by our server without any sort of checks…
-
How to create a CRUD REST API in Spring Boot
REST APIs are a very important layer in many Spring applications. Specially if you need to provide interfaces for other services in your ecosystem such as front-end applications or to external systems, such as customer systems. In this post, we will discuss how to start building your REST API using Spring Boot in order to…
-
Hashing passwords in Spring applications
When handling account passwords, you need to make sure that passwords are transmitted through a secure medium and stored in a persistent and a non-reversibly hashed format. A large majority of backend and web-based applications rely on authorization mechanisms which involve the user inserting a username and a password. When building such applications for the…
-
How to get started with MongoDB on Windows
In this guide, we will discuss how to install MongoDB on a Windows machine and how to get started with MongoDB, such as creating a new database and a new user. In this post, we will be using the MongoDB community server and Windows 10. Downloading the MongoDB Community Server To download the community edition…
-
How to use the @Value annotation from Project Lombok
In this post, we discuss what the @Value annotation from Project Lombok does and how to use it. We will also discuss frequently asked questions such as the difference between @Value and @Data. If you haven’t already, please check out our own Lombok annotations cheat sheet in order to get started with Lombok and the…