What are the architectural layers of a Spring Boot + React + MySQL application?
P粉346326040
P粉346326040 2024-04-03 10:07:06
0
1
495

I'm trying to write documentation about the application but I'm confused on how to describe the architecture.

Based on the research I did, I thought the presentation layer was my React application, the business/application layer was the Spring Boot application, and the data layer was MySQL.

This seemed logical to me, but I stumbled upon this tutorial

https://www.youtube.com/watch?v=xJC7ItRoEbw&ab_channel=Amigoscode

He says around 10:38 that the controller is part of the presentation layer, which doesn't seem to connect to what I already know.

There is another tutorial https://www.youtube.com/watch?v=udzBtJv2uls&ab_channel=Izenda which expresses my initial thoughts.

Also, I know that Spring Boot applications have multiple layers of controls, services, and repositories (or dao's), so I want to combine all of this information, but I'm not sure if I'm going to write something big if there's something wrong with that

Can you explain these to me based on my project? On the front end, I have a React app that sends a get request to a typical controller, which calls a service method that calls a repository method that communicates with the database and performs the query.

P粉346326040
P粉346326040

reply all(1)
P粉288069045

In the video, the presenter is very informal and he uses layers and layers interchangeably. A lot of people do this, you have to figure out the intent of the context.

To me, tiers usually mean distribution across different machines. The React code in MySQL, the springboot application, and the client browser typically all run on different machines, so they are different layers.

But the term "layer" does not imply such a distribution, a SpringBoot application can have a web controller layer, a service layer, and a data access layer that are all part of the same application artifact. This term is used to discuss how logic within an application is organized.

Spring began as a response to the popular assumption that applications had to be built in layers through web applications called ejb servers, which were hosted on separate clusters and communicated over the network. The Spring founders made a distinction between layers to make it easier to explain their approach. Rod Johnson's book One on One, which introduces the main ideas of Spring, uses this wording.

Whether the controller is part of the presentation layer is debatable. To me, presentation means look and feel, with controllers doing web-specific actions like exposing endpoints, validating parameters, etc., but especially in SPA, presentation is in the front-end code, while server-side only serves the data. Before the SPA controller, the controller was forwarded to the view which rendered the html on the server, so the controller and presentation were more closely related.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!