Category: Spring
-
How to use database sequences with JPA/Hibernate entities
When creating a new database table, you can decide how the table’s identifier column value will be generated. One way of doing this is to use a database sequence. A database sequence can be used to generated the next value or next value range that will be reserved for usage as table row identifier values.…
-
How to identify vulnerable dependencies in a Maven project
Software security is an essential component of any enterprise or large scale software product. Making sure that your software product is secure protects your product from a range of attacks and helps safeguard the safety of your users’ data. Sometimes, it is even required due to laws and regulations of your industry. In this tutorial,…
-
How to configure fiegn clients to perform HTTP requests in Spring
In our previous tutorial, we discussed how to configure and enable OpenFeign and Feign clients in a Spring boot application. In this tutorial, we will dig deeper into Feign clients and discuss how to create and configure Feign clients to call external services using the HTTP GET, PUT. POST and DELETE functions. We will also…
-
How to configure OpenFeign with Spring boot
In this tutorial, we will discuss how to configure OpenFeign and a Feign client in a Spring boot application in order to make a REST call to a REST API service in another application. The goal of this tutorial is to get you started with OpenFeign basics in Spring boot and to demonstrate how you…
-
How to configure path variables in Spring controllers
Path variables are an essential component which we use when interacting with REST APIs. In this tutorial, we will discuss what path variables are (not to be confused with query parameters) and how to use and configure them in Spring controllers. If you are just starting out with building REST APIs in Spring or Spring…
-
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…
-
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…