SoftwareDeveloper
SoftwareDeveloper

Reputation: 1162

In a Spring Web MVC application - how do we break up the architecture into Front-end & Back-end?

Looking at the sample Spring Web MVC application PetClinic https://github.com/spring-projects/spring-petclinic as an example.

Application typically broken up into 3 different physical tiers and within the server side it is broken into different layers:

Client side: (JavaScript/CSS etc...)

Server side: - Web - Service - Repository

Database:

Using above application as an example what constitutes front-end and back-end?

I always believe everything within the server side (web controllers/service/repositories) + database makes up the backend. But one of my colleague argue that only the database is what 'back-end' is.

Another of my colleague says only the 'Service & Repository' layers constitutes backend and he argue that stuff inside the web layer (consisting of JSP/Thymeleaf templates, form-backing objects, Controllers) is considered 'front-end'

Upvotes: 1

Views: 1447

Answers (2)

chetanpawar
chetanpawar

Reputation: 141

In simple words I would say whatever you want display to user irrespective of technology will go in View (Like HTML forms or any informative HTML page). Regarding backend i would say you want some data to display on Frontend (View in SpringMVC) so you will do any preprocessing which includes getting data from another systems through web services and all , it will go in the backend part.In the same case if you are getting data from DB you can say its backend as well.

Upvotes: 0

Manos Nikolaidis
Manos Nikolaidis

Reputation: 22254

  • In a SpringMVC app the front-end is the views. jsp files in the petclinic app are used to generate html files that are served from the server to the client. These files allow the user to view the model's data.
  • In a web application the backend is certainly not just the database. The controllers are also part of the backend. In a SpringMVC app these are classes annotated with @Controller.
  • Regarding files the petclinic app you may consider everything in src/main/webapp as the front-end and everything else the backend. Other people may disagree.
  • Mind you that a server app built with SpringMVC may be also used to expose a REST api receiving and transmitting JSON documents to a mobile app for instance. This app may implement the MVC pattern itself with its own frontend and backend.

Upvotes: 1

Related Questions