Before continuing on this tutorial, ensure you have reviewed/read part 1 before moving forward: Setting your own spring boot server via JDBC part 1 | by Michael Tong | Dec, 2020 | Medium

In part 2, we will talk about how to set up endpoints to perform crud operations, as well as the structure of the rest of the application.

To have some context as to how the application will be implemented, let’s take a look at the following image:

Before continuing on this tutorial, ensure you have reviewed/read part 1 before moving forward: Setting your own spring boot server via JDBC part 1 | by Michael Tong | Dec, 2020 | Medium

In part 2, we will talk about how to set up endpoints to perform crud operations, as well as the structure of the rest of the application.

To have some context as to how the application will be implemented, let’s take a look at the following image:

We have the controller, which listens to client requests via api endpoints. Depending on what the requests are looking for, we call the respective service which handles the business logic.

Often times this can mean calling another 3rd party service or sanitizing data coming from the controller.

For example, if we are building a backend server that handles/manages aws ec2 services, we would need to make a call to aws service to either create/modify/delete exist ec2 instances, and update our database to reflect the true status of the instances.

If that was a bit hard to understand, let’s use a shopping cart application as an example. We can have a controller that takes in endpoints to purchase items. From there, we receive the request and calls a shoppingCart service, which checks if the data was received from the request is valid. If it is valid, the service interacts with the dao layer, which updates the database by inserting a new entry for a new transaction.

Afterward, you can return either the record of the transaction or a customized request with the 200 code from the dao layer. This will be passed back to the service layer and then to the controller layer, in which the controller will give the response back to the client.

#spring #postgres #spring-boot #java #jdbc

Setting your own spring boot server via JDBC part 2
1.20 GEEK